Reading JSON without Arrays

Posted by christian.bryan@capita.co.uk on 06-Feb-2015 09:04

Hi 

I have to read some JSON that does not contain an object name or Arrays:

I.e.

{
"BankBIC": "CP75851",
"BranchBIC": "SMC",
"BankName": "THE CO-OPERATIVE BANK PLC",
"BankOfficeTitle": "SMILE - CURRENT",
"BranchName": "Smile - Current",
"OfficeTitle": "SMILE - CURRENT",
"ContactAddress1": "P.O Box",
"ContactAddress2": "Delf House",
"ContactAddress3": "",
"ContactAddress4": "",
"ContactAddressCity": "Blah",
"ContactAddressCounty": "Lancashire",
"ContactAddressPostCode": "WN8",
"ContactAddressPostCountry": "UNITED KINGDOM",
"ContactPhoneNumber": "08457 212212",
"SortCode": "089286",
"DateLastChanged": "2009-09-16T00:00:00.000",
"TransactionInfo": {
"BacsCredits": true,
"BacsDebits": true,
"FasterPaymentsService": true,
"ChapsSterling": true,
"DirectDebitInstructions": true,
"UnpaidChequeClaims": true,
"DividendInterest": true,
"BuildingSocietyInterest": true
},
"ChapsBankBIC": "CP2",
"ChapsBranchBIC": "XX"
}

I can't see a way of defining a prodataset or temp table to match this data in OE 10.2.b for this?

Any help appreciated 

All Replies

Posted by Robin Brown on 06-Feb-2015 14:26

 
The JSON you describe cannot map to a temp-table or dataset, in order to be loaded with READ-JSON.  For our JSON representation , Temp-tables are arrays of row objects, and  a dataset is an object made up of temp-table arrays.  So for 10.2B, this will not work.  We added the ABL JSON API in Release 11, which might help you.
 
Regards,
Robin
 
 
[collapse]
From: christian.bryan@capita.co.uk [mailto:bounce-christianbryancapitacouk@community.progress.com]
Sent: Friday, February 06, 2015 10:05 AM
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] Reading JSON without Arrays
 
Thread created by christian.bryan@capita.co.uk

Hi 

I have to read some JSON that does not contain an object name or Arrays:

I.e.

{
"BankBIC": "CP75851",
"BranchBIC": "SMC",
"BankName": "THE CO-OPERATIVE BANK PLC",
"BankOfficeTitle": "SMILE - CURRENT",
"BranchName": "Smile - Current",
"OfficeTitle": "SMILE - CURRENT",
"ContactAddress1": "P.O Box",
"ContactAddress2": "Delf House",
"ContactAddress3": "",
"ContactAddress4": "",
"ContactAddressCity": "Blah",
"ContactAddressCounty": "Lancashire",
"ContactAddressPostCode": "WN8",
"ContactAddressPostCountry": "UNITED KINGDOM",
"ContactPhoneNumber": "08457 212212",
"SortCode": "089286",
"DateLastChanged": "2009-09-16T00:00:00.000",
"TransactionInfo": {
"BacsCredits": true,
"BacsDebits": true,
"FasterPaymentsService": true,
"ChapsSterling": true,
"DirectDebitInstructions": true,
"UnpaidChequeClaims": true,
"DividendInterest": true,
"BuildingSocietyInterest": true
},
"ChapsBankBIC": "CP2",
"ChapsBranchBIC": "XX"
}

I can't see a way of defining a prodataset or temp table to match this data in OE 10.2.b for this?

Any help appreciated 

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Matt Verrinder on 07-Feb-2015 02:11

Chris,


We use a parser very similar to the SAX parser for processing JSON in 10.2B - let me know if you’re interested.

Matt Verrinder
Telephone: +44 777 576 3234

The contents of this email and any attachments are confidential and intended solely for the use of the individual to whom it is addressed. Unauthorised use, disclosure, storage, copying or distribution of any part of this e-mail is not permitted. If you are not the intended recipient, please destroy the e-mail, remove any copies from your system and inform the sender immediately by return. Any views or opinions presented are solely those of the author and do not necessarily represent those of Rule Six Ltd. Activity and use of the Rule Six Ltd. e-mail system is monitored to secure its effective operation and for other lawful business purposes.

Rule Six Ltd. Registered in England and Wales, No. 7853976. Registered Office: Unit 11, Hove Business Centre, Fonthill Road, Hove, East Sussex, BN3 6HA.


Thread created by christian.bryan@capita.co.uk

Hi 

I have to read some JSON that does not contain an object name or Arrays:

I.e.

{
"BankBIC": "CP75851",
"BranchBIC": "SMC",
"BankName": "THE CO-OPERATIVE BANK PLC",
"BankOfficeTitle": "SMILE - CURRENT",
"BranchName": "Smile - Current",
"OfficeTitle": "SMILE - CURRENT",
"ContactAddress1": "P.O Box",
"ContactAddress2": "Delf House",
"ContactAddress3": "",
"ContactAddress4": "",
"ContactAddressCity": "Blah",
"ContactAddressCounty": "Lancashire",
"ContactAddressPostCode": "WN8",
"ContactAddressPostCountry": "UNITED KINGDOM",
"ContactPhoneNumber": "08457 212212",
"SortCode": "089286",
"DateLastChanged": "2009-09-16T00:00:00.000",
"TransactionInfo": {
"BacsCredits": true,
"BacsDebits": true,
"FasterPaymentsService": true,
"ChapsSterling": true,
"DirectDebitInstructions": true,
"UnpaidChequeClaims": true,
"DividendInterest": true,
"BuildingSocietyInterest": true
},
"ChapsBankBIC": "CP2",
"ChapsBranchBIC": "XX"
}

I can't see a way of defining a prodataset or temp table to match this data in OE 10.2.b for this?

Any help appreciated 

Stop receiving emails on this subject.

Flag this post as spam/abuse.


Posted by Lieven De Foor on 10-Feb-2015 09:48

Have a look at the abljson project by Marian Edu (sourceforge.net/.../abljson)

This thread is closed