JSON format Parsing

I am wondering what secret magic is going on when Panorama X is exporting or importing JSON.

I have tried various tag combinations with tagdata(), tagarray() and settagdata() but it is not consistently returning the tag, the data or changing the data.

What statements or functions will parse JSON?

It sounds like you are trying to “roll your own” json parsing but Panorama has built in functions for that. In fact, I didn’t roll my own either, these functions are built using Apple’s JSON parsing code that comes built into macOS. JSON parsing can be surprisingly complex, so it’s best to leave it to experts. If you open the Help wizard and search for json you’ll get a list of all the related functions.

Hi Jim,

Using the help file I see the various export and import functions and statements but what I am looking for is a way to directly edit a JSON formatted record in a similar way one would use settagdata to change the value of an xml tag. Is that possible?

No, that is not possible, at least not directly. You can use jsonimport( to convert the JSON into a data array or dictionary, then modify that, then use jsonexport( to convert back to JSON. If the original json text is a one level array or dictionary, that will be fairly straightforward. If the json text contains nested structures that will get more complicated, though still definitely possible.

Is it possible to send a json file from Panorama X to Panorama 6 Enterprise Server? I have tried and I receive an error when I use Panorama X to retrieve the json file from Enterprise Server record.

I don’t understand this question. JSON is just text, nothing special about that. So what are you actually doing to “send a json file”? What sort of error are you seeing?

One issue could be that Panorama X will generate UTF-8 encoded text. Panorama 6 doesn’t understand UTF-8 text. So you might want to use the texttobinary( function to convert the text to MacOSRoman encoding before sending it to Panorama 6. Then use binarytotext( to convert it back when bringing it back into X. However, I wouldn’t expect errors due to encoding issues, just wrong characters for some accented characters. If you are just using letters, numbers and basic punctuation then even that won’t be a problem.