HI,
I need to read JSON that does not contain an object name or array.
i.e.
"invoice_info": {
"id": "6376705",
"amount": "1.00",
"invoice_number": "111",
"last_payment_date": "28/05/2018",
"subscriber_no": "111",
"company_no": null,
"query_id": null,
"owner_name_masked": "MU*** MU***",
"foundation_id": 143
}
I can't see any example in OE 11.7.
Any help is appreciated.
Thx.
I don't think OpenEdge supports that kind of JSON. You need to add a pair of { } around the string before parsing it.
I don't think OpenEdge supports that kind of JSON. You need to add a pair of { } around the string before parsing it.
OpenEdge doesn't support this kind of JSON:
This is not valid JSON... See https://jsonlint.com/ for example.
This is not valid JSON... See https://jsonlint.com/ for example.
Thanks your reply. I checked JSON is not correct. Below correct, I think, JSON.
{
"count": 1,
"next": null,
"previous": null,
"results": [{
"id": "6376703",
"status": "open",
"amount": "1.00",
"payment_time": null,
"invoice_info": {
"id": "6376705",
"amount": "1.00",
"invoice_number": "111",
"last_payment_date": "28/05/2018",
"subscriber_no": "111",
"company_no": null,
"query_id": null,
"owner_name_masked": "MU*** MU***",
"foundation_id": 143
}
}]
}
My question is for "invoice_info". With this example
def var joObj2 as JsonObject.
i=oJsonArray:LENGTH.
joObj2 = oJsonArray:GetJsonObject(i).
def var charstring as char.
charstring = string(joObj2:GetJsonText("invoice_info")).
message charstring.
charstring contains:
"id": "6376705",
"amount": "1.00",
"invoice_number": "111",
"last_payment_date": "28/05/2018",
"subscriber_no": "111",
"company_no": null,
"query_id": null,
"owner_name_masked": "MU*** MU***",
"foundation_id": 143"
How I can READ separately as if it were an array.
Thanks.
G.