[fpc-pascal] Finding the path of a TJSONObject?

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Thu Jun 16 16:58:25 CEST 2016


Hi,

Is there a method (just so you know GetPath() wasn't it) that returns
the "path" or hierarchy of a TJSONObject instance?

eg:
 I can do:

  obj := lRootData.Find('Report.Pages.0.Watermark.Font');

But how do I do the reverse. Lets say I have a TJSONObject instance in
the obj variable. How do I query the path to that object in the whole
JSON hierarchy - the 'Report.Pages.0.Wartermark.Font' text listed above?

TJSONObject has no Parent or Owner property either? So I'm currently
using a hack-ish solution, and would like to know if there is a better
solution available.

I'm using FPC 2.6.4. If fpjson is improved in FPC 3.0 or 3.1, then I'll
simply copy that unit out and use that instead. I haven't checked the
fpjson code in FPC 3.0 or 3.1 yet.

Regards,
  Graeme




More information about the fpc-pascal mailing list