Json Formatter

Xbase++ 2.0 Build 554 or later
Post Reply
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Json Formatter

#1 Post 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.
The eXpress train is coming - and it has more cars.

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Json Formatter

#2 Post by Tom »

I do use JSONlint: https://www.jsonlint.com/
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Json Formatter

#3 Post 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
Best regards,

Chris.
www.aboservice.be

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Json Formatter

#4 Post by Tom »

Chilkat is just unbelievable. Great library.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Json Formatter

#5 Post by rdonnay »

Thank you all for the recommendations.
I use Chilkat for SFTP and some other things.
Their products are very good.
The eXpress train is coming - and it has more cars.

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Json Formatter

#6 Post 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.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Json Formatter

#7 Post 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.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Json Formatter

#8 Post by rdonnay »

Great Success!!

Now our Taxi Web Service activity browser is complete !!
Capture.JPG
Capture.JPG (198.79 KiB) Viewed 3980 times
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 478
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Json Formatter

#9 Post by Wolfgang Ciriack »

As always, no download of pictures or zip files possible :oops: :o :roll:
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Json Formatter

#10 Post 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.
The eXpress train is coming - and it has more cars.

Post Reply