jFiles - getting the name from an object?

I need to get the name of an object or value in a JSON file. I don’t know the structure of the file in advance, therefore I need the names. Have looked in the documentation for jFiles but have not become much wiser.
But maybe I have completely misunderstood something.

Regards Niels

The Json is stored as a “tree” (once you’ve done a Load).
You can then “walk” the tree using Records and Get.
If you look in jfiles.clw you’ll find a WalkNames method that “walks” the tree and sends the information to debugview++. That will be a good example for you.

Try using this function dataJSON.GetByName(‘nameoftheobject’)

Hi Bruce

Thanks for the help. It works fine.
But I have had to remove “RPIVAT” on ObjectName in jfiles.inc.
My abilities are not sufficient to see if it’s wise to do or if there is another way?

The methods are for retrieving the value when you know the name. I don’t know the name so it won’t do.
But thanks anyway

You could use a product that specializes in parsing strings and get the names and values.


Niels: Is that Danish for “PRIVATE” ? :grinning:

Careful Don, you will be howled down! :crazy_face:

They used to say “All roads lead to Rome” - the complaint these days is all answers lead to…

It was just to challenge someone’s brain :crazy_face: In fact, it’s called “privat” in Danish. Now you know…

1 Like