But the path option doesn't work when there is no named base element Scott.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Nov 1, 2018, at 5:47 PM, Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> wrote:

PLEASE DON'T EVER USE "skip_document_node".

I should never have added that mis-feature.

If you want to skip part of the document, use "document_name" together with the RPG path= option.


On 11/1/2018 4:32 PM, Jon Paris wrote:
Since the IBM version kinda worked you may need to specify an extra option to the YAJL parser.

You haven't shown us your full JSON so I can't be sure but ... there is a bug/feature in IBM's version that allows it to parse JSON that fails with YAJLINTO. On the other hand YAJLINTO handles the more common form of JSON that the IBM version requires code changes to handle.

The usual problem is indeed at the root element and adding the option '{ "skip_document_node": true }' to the YAJL parser will deal with it. Syntax looks like this.

DATA-INTO customer %Data( jsonData: 'case=any')
%parser( 'SKLEMENT/YAJLINTO'
: '{ "skip_document_node": true }');


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Nov 1, 2018, at 5:14 PM, Gerald Magnuson <gmagqcy.midrange@xxxxxxxxx> wrote:

I just tried Scott's YAJLINTO...
that says I have problems at the root element...


On Thu, Nov 1, 2018 at 2:26 PM Bradley Stone <bvstone@xxxxxxxxx> wrote:

Actually, it was online JSON validator that I said I used.. not a parser.
Just woke up from a nap and was reading a long thread on Midrange that was
making my head spin.. haha.

Sorry about the confusion.


On Thu, Nov 1, 2018 at 2:24 PM Bradley Stone <bvstone@xxxxxxxxx> wrote:

Jon,

My comment states "online" JSON parser. I doubt any of the 3 I tried
that
show up at the top of Google Search use either Scotts or IBM's. :)

But, I agree, I am sticking with Scott's YAJL parser for a while now.

Bradley V. Stone
www.bvstools.com
GreenTools for # Slack # <https://www.bvstools.com/g4slk.html>: Easy to
use interfaces for sending and receiving messages on Slack!

On Thu, Nov 1, 2018 at 2:22 PM Jon Paris <jon.paris@xxxxxxxxxxxxxx>
wrote:
Which JSON parser are you using? Then IBM supply as a sample with
DATA-INTO or Scott's YAJL-based one?

It looks like you are using IBM's and that has a number of "holes" and
is
only really intended as a POC not production ready.

Try it with Scott's and see if you still get the error.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Nov 1, 2018, at 1:47 PM, Greg Wilburn <
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
Agreed... it might be a similar issue with handling empty objects

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Bradley Stone
Sent: Thursday, November 01, 2018 12:41 PM
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Subject: Re: extract JSON with DATA_INTO blows up when var is blank
((from midrange-l))
I'd contact IBM for assistance. If you validate {"test":""} with
online JSON validation programs it seems to report it's valid.
Bradley V. Stone
www.bvstools.com
MAILTOOL Benefit #18 <https://www.bvstools.com/mailtool.html>:
Ability
to use SSL, TLS or OAuth 2.0 authentication. (OAuth 2.0 only available
with
Google or Microsoft Office 365).
On Thu, Nov 1, 2018 at 10:58 AM Gerald Magnuson <
gmagqcy.midrange@xxxxxxxxx>
wrote:

ok... this might be a clue...
if I change my blank string to null ex:
before:


{"articles":[{"id":2677,"itemNumber":"12239992","assetId":"","userId":"","vinNumber":"","articleId":2677,"
after:


{"articles":[{"id":2677,"itemNumber":"12239992","assetId":null,"userId":null,"vinNumber":null,"articleId":2677,"
but I don't think the process that creates the JSON can substitute
null for blank...



On Thu, Nov 1, 2018 at 10:40 AM Gerald Magnuson <
gmagqcy.midrange@xxxxxxxxx>
wrote:

just tried it.... same error
DATA-INTO articles %Data( retdata:
'allowmissing=yes case=any countprefix=count_ ')
%Parser('GEMLIB/JSONPARSE');

On Thu, Nov 1, 2018 at 10:32 AM Greg Wilburn <
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

Have you tried "allowmissing"?

Just curious to see if you still get the error.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Gerald Magnuson
Sent: Thursday, November 01, 2018 11:29 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <
rpg400-l@xxxxxxxxxxxx>
Subject: Re: extract JSON with DATA_INTO blows up when var is blank
((from midrange-l))

I just applied that PTF, recompiled the parser, and then my
program....
same error...
if I put data into those elements, I don't get the error...


On Thu, Nov 1, 2018 at 10:06 AM Greg Wilburn <
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

Wonder if this is similar/related to the fix for an empty array?

The PTFs for this issue are now available:
7.2 PTF SI68422
7.3 PTF SI68421


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf
Of Gerald Magnuson
Sent: Thursday, November 01, 2018 10:58 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <
rpg400-L@xxxxxxxxxxxx>
Subject: extract JSON with DATA_INTO blows up when var is blank
((from
midrange-l))

it appears that when the parser hits a column that is empty, I
get RNX0358, condition 12...
and by empty I mean, "column-name":"" ...
like "userId":"",

my data-into statement:
DATA-INTO articles %Data( retdata:
'case=any countprefix=count_')
%Parser('GEMLIB/JSONPARSE');
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx 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 the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx 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 the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please
take
a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx 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 the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please
take
a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx 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 the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take
a
moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx 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 the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx 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 the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx 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 the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx 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 the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx 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 the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx 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 the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx 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 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.