× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello,

Typically, if a user is going to display JSON in a pretty format, you can send it to them in any format, and they'll use a tool that displays it nicely for them.   So, no special processing is needed on your end.

If your requirements are different and its important to do this in program code...  this is unusual, but should be possible with YAJL.   Open an existing JSON document into a tree using yajl_stmf_load_tree() (or one of the other yajl tools that loads a tree) and then use YAJL's generator to create output.   There's a routine called YAJL_genFromNode that you can call, pass a node (such as the document node returned by yajl_stmf_load_tree) and it will add that entire tree to the generated JSON.   If you've configured the JSON generate to generate in "pretty" format, the yajl_genFromNode will essentially copy the structure, but the output will be "pretty".

Good Luck


On 10/27/2020 3:09 PM, Jack Prucha wrote:
I want to present a JSON payload to the user in an easy-to-read format. Output like JSONFormatter.org. Linking to a web site is a non-starter so I'm searching for something iSeries based.

I have Scott's YAJL software installed and am using it with Data-Into. However, I don't see an example in his thorough documentation to take any JSON and pretty up the formatting for human viewing. There's a CLE pgm in his YAJLLIB72 called JSON_Refmt but I can't figure it out.

Most RPGLE JSON open source I see is designed to create or disassemble JSON - not display it.

Any suggestions?

TIA
Jack


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.