Esteban,

Try docNode = yajl_buf_load_tree(%addr(RdiRec) : RdiRecLen : errMsg); from YAJL

I use in in 100's of programs.

The sql JSON is Java based and I have find more issues with java on the iseries then Scotts programs.
also Scott give better support.. __


Thanks
John Slanina


On 2/27/20, 7:21 AM, "WEB400 on behalf of Tim Fathers" <web400-bounces@xxxxxxxxxxxxxxxxxx on behalf of X700-IX2J@xxxxxxxxxxx> wrote:

I'm assuming by "parse" you mean "construct" right? In any case why bother with a third party library, why not just use SQL?

For single values just use:
exec sql set :myField = coalesce(json_value(JSON_OBJECT, '$.error_message' returning varchar(256)), '');

For multiple values use:
select ... from json_table(JSON_OBJECT, '$.', ...);

..an example of which can be found here https://github.com/fathert/json-rpg-example/blob/master/json.sqlrpgle

Tim.

________________________________
From: WEB400 <web400-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Cabero <cabero@xxxxxxxxxxxxx>
Sent: 27 February 2020 10:33
To: WEB400@xxxxxxxxxxxxxxxxxx <WEB400@xxxxxxxxxxxxxxxxxx>
Subject: [WEB400] JSON

Hello All.

I parse JSON data using YAJL in RPG [1]but can't consume JSON.
Can anybody point me to working open source doing so please.
Scott Klement's article was easy to follow for providing JSON. [2]
One comment on LinkedIn insinuated YAJL is not the way to go but IWS?

--
Yours sincerely.
Esteban Cabero
https://nam12.safelinks.protection.outlook.com/?url=www.linkedin.com%2Fin%2Fcabero&amp;data=02%7C01%7C%7C38ff8a8ae08f483f2b8f08d7bb682a26%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637183928366943503&amp;sdata=1EbHbxuhHM4EY5znYbmtvEqjUUDyK0CdM0MHZ7J1HDI%3D&amp;reserved=0
Cell: +27(0)843963122

Links:
------
[1]
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fibmrestapi.blogspot.com%2Fp%2Fsacascr1-totallyfully-free-rpg.html&amp;data=02%7C01%7C%7C38ff8a8ae08f483f2b8f08d7bb682a26%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637183928366943503&amp;sdata=eRCk%2FYVkl%2BorsHFdTInF%2BeTZN22%2F35E23tdCwftBZr8%3D&amp;reserved=0
[2] https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fibmrestapi.blogspot.com%2Fp%2Fblog-page.html&amp;data=02%7C01%7C%7C38ff8a8ae08f483f2b8f08d7bb682a26%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637183928366943503&amp;sdata=40CpTquy138%2FNUUGXK01JYUNRZCpKTo0SIstngeWRic%3D&amp;reserved=0
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&amp;data=02%7C01%7C%7C38ff8a8ae08f483f2b8f08d7bb682a26%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637183928366943503&amp;sdata=AHF%2BamVPxDEjA%2FS0N%2BCH82XOE%2Fi4Y%2Fyd0XprP7iwNjI%3D&amp;reserved=0
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&amp;data=02%7C01%7C%7C38ff8a8ae08f483f2b8f08d7bb682a26%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637183928366943503&amp;sdata=lUoU%2Fo68Ye%2Bi%2BIDcdbcpH4eSuoNirArpB7mSI6tSgFM%3D&amp;reserved=0.

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.




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-2021 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.