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



Hi Everyone,

I am using the Scott Klement's YAJL parser for Parsing the JSON Document. I
am receiving an error when i parsing a document. Let me explain it in two
scenario, Scenario 1 (I can Parse the JSON Document) and Scenario 2 (I
cannot Parse the JSON Document which i am receiving an Error)

Scenario 1: (Parsed Successfully)
JSON Document:
{
"metadata":{
"propertyId":"E4",
"suren":"suren",
"clientId":"ATRIENTKIOSK",
"transDateTime":"2017-11-30T18:25:08Z",
"transStation":"DEVICE1",
"transEmployee":"MASTR"
},
"data":{
"playerProfile":{
"title":"Mr",
"firstName":"John",
"lastName":"Smith"
}
}
}

Data Structure:
Dcl-Ds playerProfile qualified;
title char(5);
firstName Char(25);
lastName char(25);
End-Ds;

RPG Code for Parsing this document
data-into(E) playerProfile %DATA(Wrk_Json: case=convert doc=string
path=json/data/playerProfile allowmissing=yes allowextra=yes)
%PARSER('YAJLINTO' :'{ "document_name": "json",
"value_null": " " }');
This one works fine.

Scenario 2: (Unable to Parse, got an Error while Parsing)

Add one more array in the document and trying to parse the same
playerProfile i am getting error. Sample as below
JSON Document:
{
"metadata":{
"propertyId":"E4",
"suren":"suren",
"clientId":"ATRIENTKIOSK",
"transDateTime":"2017-11-30T18:25:08Z",
"transStation":"DEVICE1",
"transEmployee":"MASTR"
},
"data":{
"playerPin":{
"pinNumber":"7924"
},
"playerProfile":{
"title":"Mr",
"firstName":"John",
"lastName":"Smith"
}
}
}

Data Structure:
Dcl-Ds playerProfile qualified;
title char(5);
firstName Char(25);
lastName char(25);
End-Ds;

RPG Code for Parsing this document
data-into(E) playerProfile %DATA(Wrk_Json: case=convert doc=string
path=json/data/playerProfile allowmissing=yes allowextra=yes)
%PARSER('YAJLINTO' :'{ "document_name":
"json", "value_null": " " }');

This Scenario Errored Out.

Could you please someone let me know whether this scenario is not handled
in YAJL Parser or am i doing something wrong?

Regards,
Surender K

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.