Json formatter

Does anyone have any json formatting code in Xojo?

I have a “Massive wall of json”. Its hard on the eyes. The only way I know to format it is to go to https://jsonformatter.curiousconcept.com/ and cut and paste.

Are you asking this because JSONItem.Compact = false is currently broken in 2021r3.1?
This is the way you’re supposed to do it, but it’s broken.

I have a BBEdit Text Filter shell script to format JSON that uses Python.

python -m json.tool

Tim I have a log file of the raw json we send to an API. All of the raw requests and responses are saved as text in a database.

when I look at the Requests we send form our Xojo app. Its ugly and unformatted.

the response we get back are nice and neat.

I need to clean up the human readability of our own requests in our logs.

I want to run it in code on the json just before I write it to the DB/log

In the past I’ve used this:

1 Like

JSONItem in 2020r2.1 did not exhibit this failure, if that’s an option.

http://jsoneditoronline.org for online

Or jsonItem.Compact = False in code