...right, but that does that have to do with JSON parsing? That's one of the HTTP related helper functions, which as I said do use the JVM.
This, on the other hand, does not:
select json_value('{"error_message": "Test"}', '$.error_message' returning varchar(256)) as ERROR
from(values('')) x
________________________________
From: WEB400 <web400-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Slanina, John via WEB400 <web400@xxxxxxxxxxxxxxxxxx>
Sent: 27 February 2020 14:30
To: Web Enabling the IBM i (AS/400 and iSeries) <WEB400@xxxxxxxxxxxxxxxxxx>
Cc: Slanina, John <jslanina@xxxxxxxxxx>
Subject: Re: [WEB400] JSON
Yeap Tim, looking at my code
exec sql set :query = systools.urldecode(:query,'UTF-8');
turned on the JVM.
On 2/27/20, 8:23 AM, "WEB400 on behalf of Tim Fathers" <web400-bounces@xxxxxxxxxxxxxxxxxx on behalf of X700-IX2J@xxxxxxxxxxx> wrote:
>The sql JSON is Java based and I have find more issues with java on the iseries...
Not as far as I know it isn't (and I see no evidence of the JVM being invoked when the JSON functions are used). I think you maybe thinking of the HTTP functions, which do use the JVM.
Tim.
________________________________
From: WEB400 <web400-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Slanina, John via WEB400 <web400@xxxxxxxxxxxxxxxxxx>
Sent: 27 February 2020 14:11
To: Web Enabling the IBM i (AS/400 and iSeries) <WEB400@xxxxxxxxxxxxxxxxxx>
Cc: Slanina, John <jslanina@xxxxxxxxxx>
Subject: Re: [WEB400] JSON
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://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffathert%2Fjson-rpg-example%2Fblob%2Fmaster%2Fjson.sqlrpgle&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128521681&sdata=UpJQ1ow8I0ss75e6CoACh2rJ6gZv%2FCP8a%2FkNdAT81%2FU%3D&reserved=0
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://nam05.safelinks.protection.outlook.com/?url=www.linkedin.com%2Fin%2Fcabero&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128521681&sdata=8Mqxwa2a%2FAhgh29rD6Nt3DgmryJWJE3tVEAcV84sPtk%3D&reserved=0
Cell: +27(0)843963122
Links:
------
[1]
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fibmrestapi.blogspot.com%2Fp%2Fsacascr1-totallyfully-free-rpg.html&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128526673&sdata=1RuuU3HYDKvBLAuGrADiuoyfKwugzznZ%2BE%2FfM67vCyc%3D&reserved=0
[2]
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fibmrestapi.blogspot.com%2Fp%2Fblog-page.html&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128526673&sdata=7VjiwNnllFGOcXuCCe9NdNjdraD643guMqY3l6OV3%2B0%3D&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://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128526673&sdata=KP68oJKhaFZ%2BVxQSAIJ8lXy61Y5Z0ZZBs8%2FjPqr8M9g%3D&reserved=0
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128531666&sdata=Spj%2BafPDbA6bWtzbJzUNJ5tjyPcUUjXFDa8%2FNzwYg20%3D&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://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128531666&sdata=7v54XERa183n5hVx4ZkgDju%2BgcZlvGcrQNuiJXvBWWM%3D&reserved=0
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128531666&sdata=Spj%2BafPDbA6bWtzbJzUNJ5tjyPcUUjXFDa8%2FNzwYg20%3D&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://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128531666&sdata=7v54XERa183n5hVx4ZkgDju%2BgcZlvGcrQNuiJXvBWWM%3D&reserved=0
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128536655&sdata=vu5CRfTvqCniW8g2MpbPBtaoePkYkn6DZlUIVq8NSOg%3D&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://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128536655&sdata=SPbCXJdCQH0yOwSD%2BFsxunNLVnDFE5drhqUukcHvv7s%3D&reserved=0
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128536655&sdata=vu5CRfTvqCniW8g2MpbPBtaoePkYkn6DZlUIVq8NSOg%3D&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://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128541645&sdata=WgIbkDIAIkGkjmC4YpTDSHiH6Q8ICamxDn2l1%2F%2BX6dw%3D&reserved=0
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&data=02%7C01%7C%7Ce9cbb84bf6b84fdd2e5108d7bb892c3a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637184070128541645&sdata=cZAoHXSjPRR7UZZx2oe5kAMgut%2BTUTGGn4zwIK0taZk%3D&reserved=0.
As an Amazon Associate we earn from qualifying purchases.