HI all,
I'm trying to use the YAJLINTO service program, but I'm doing something wrong.
Here's a code sample:
My problem is that I have to parse a JSon with two array, but sometimes one of these arrays is empty, in these case the value of Num_Array1 is 0 instead of 1.
What I'm doing wrong?
Many thanks.
Bye
I'm trying to use the YAJLINTO service program, but I'm doing something wrong.
Here's a code sample:
Code:
**Free Ctl-Opt DftActGrp(*No) ActGrp('QILE') BndDir( 'YAJL/YAJL') DatFmt(*Iso) TimFmt(*Iso) Alwnull(*UsrCtl) DecEdit('0.') DftName(TESTJSON) Option(*SrcStmt:*NoDebugIo :*NoUnRef) Debug; dcl-s jsondata char(1000) inz('+ {"Reqid":2,"client":"abc","array1":[{"order":1,"qta":1,"Price":550}],"array2":[]}'); Dcl-Ds TestJ Qualified ; num_Array1 Int(10) ; num_Array2 Int(10) ; ReqId Int(10) ; Client Char(5) ; Dcl-Ds Array1 Dim(3) ; Order Int(10) ; Qta Int(10) ; Price Packed(15 :5) ; End-Ds Array1; Dcl-Ds Array2 Dim(3) ; field1 Char(6) ; field2 Int(10) ; End-Ds Array2; End-Ds; dcl-ds *N psds; count Int(20) Pos(372); end-ds; clear TestJ ; DATA-INTO TestJ %Data(jsonData: 'case=convert doc=string countprefix=num_ allowmissing=yes allowextra=yes' ) %Parser('YAJL/YAJLINTO' ); *InLR = *On;
What I'm doing wrong?
Many thanks.
Bye
Comment