|
I think we'll have to agree to disagree on that one Jon, it's undoubtedly true that you can write some horrendous SQL, but with a bit of effort it can be quite elegant! IMO SQL is a far easier and more natural fit for this kind of task.
Get Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Jon Paris <jon.paris@xxxxxxxxxxxxxx>
Sent: Thursday, June 24, 2021 5:19:12 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: JSON, DATA-GEN, YAJL, and Special Character Field Names
Agreed to the "roll your own" comment - but there is a really easy way to handle this with DATA-GEN as per my other post.
The SQL option is fine but personally I find that with SQL the complexity level grows very quickly and has a tendency to result in write-only code.
Jon Paris
On Jun 24, 2021, at 11:58 AM, Tim Fathers <tim@xxxxxxxxxxxxx> wrote:--
Both parsing and generating JSON is very easy using [embedded] SQL if you're on >=7.2, I would say definitely don't roll your own solution.
Tim.
________________________________
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Stephen Piland <Stephen@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sent: 24 June 2021 15:42
To: rpg400-l@xxxxxxxxxxxxxxxxxx <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: JSON, DATA-GEN, YAJL, and Special Character Field Names
I have used DATA-INTO and YAJL a good bit and have been able to consume / decode JSON messages that contain field / element names with disallowed characters. For example.. e-Commerce and YAJLINTO converts it to e_Commerce. There isn't a way to do this in reverse, is there? I'm thinking no since YAJLGEN would not know the special character we'd need to put into the JSON message.
I'm thinking we'll have to use SQL or build the string manually.
Any thoughts would be appreciated.
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.
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.