Page 1 of 1

Json Formatter

Posted: Wed Mar 30, 2022 1:43 pm
by rdonnay
Has anyone written a routine that takes a Json string created by Var2Json() and formatted it with Spaces and CRLF so that it will view nicely in a text window?

I could probably write something but it may take some time.
I hope that there is some Xbase++ code that someone will share.

Re: Json Formatter

Posted: Wed Mar 30, 2022 11:27 pm
by Tom
I do use JSONlint: https://www.jsonlint.com/

Re: Json Formatter

Posted: Wed Mar 30, 2022 11:53 pm
by skiman
Hi Roger,

You can use the free Chilkat json class.

Code: Select all

LOCAL lcStrJson
LOCAL loJson
LOCAL lcStrFormattedJson

lcStrJson = "... JSON to be formatted ..."
loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson:Load(lcStrJson)
loJson:EmitCompact = 0
lcStrFormattedJson = loJson:Emit()
? lcStrFormattedJson

RELEASE loJson

Re: Json Formatter

Posted: Wed Mar 30, 2022 11:56 pm
by Tom
Chilkat is just unbelievable. Great library.

Re: Json Formatter

Posted: Thu Mar 31, 2022 1:03 pm
by rdonnay
Thank you all for the recommendations.
I use Chilkat for SFTP and some other things.
Their products are very good.

Re: Json Formatter

Posted: Thu Mar 31, 2022 11:57 pm
by Tom
I use Chilkat for SFTP and some other things.
I bought it for the same reason. Yes, good software. And very feature rich.

Re: Json Formatter

Posted: Fri Apr 01, 2022 1:27 am
by skiman
Hi,

Is the first place to look for when I need a special function, very good investment.

Sending mails and reading mailboxes is easy with it. I never have any problems to configure mailservers as Office365, Gmail, ... Works always.

Good documentation and a lot of samples for everything you need.

There is also https://tools.chilkat.io/ with some nice samples and tools. Converting a json or xml to source code can be a real time saver.

Re: Json Formatter

Posted: Fri Apr 01, 2022 6:03 am
by rdonnay
Great Success!!

Now our Taxi Web Service activity browser is complete !!
Capture.JPG
Capture.JPG (198.79 KiB) Viewed 4098 times

Re: Json Formatter

Posted: Fri Apr 01, 2022 6:09 am
by Wolfgang Ciriack
As always, no download of pictures or zip files possible :oops: :o :roll:

Re: Json Formatter

Posted: Fri Apr 01, 2022 7:41 am
by rdonnay
I edited and attached it again.

When this big project of mine winds down, I hope to find time to update the PhpBB software with hopes that it will fix that problem.