Resolved Extract Value(s) From Json

I'm calling a rest service and getting back the below JSON. I tried to build a dynamic dataset but since the the JSON document omits the outer object I get errors 15358 and 15374 which I can't seem to find a work around.

I then tried picking the specific data I need using:

oObject = CAST(oEntity, JsonObject).
oNestObject1 = oObject:GetJsonObject(""). /* this should be the name of the outer object */
cRequestID = oNestObject1:GetJsonText('requestId').

But without the name of the outer object I can't grab the value(s). Any ideas as to how to resolve this?

Thanks in advance,

Rod



{
"requestId": "f9f471c9-4c3f-403a-86e7-aadae573350f",
"application": "XCDS",
"genDt": "",
"createDt": "2017-08-07T14:35:14.931-04:00",
"timeToLive": 60,
"runAfterDate": "",
"runAfterRequestId": null,
"fixId": null,
"fixOption": null,
"status": "Maintenance never sent",
"sent": false,
"_links": [{
"rel": "appList",
"uri": "http:\/\/smisdev.mydomain.com\/polling\/v1\/app\/XCDS",
"methods": [
"GET",
"POST",
"OPTIONS"
]
},
{
"rel": "operations",
"uri": "http:\/\/smisdev.mydomain.com\/polling\/v1\/f9f471c9-4c3f-403a-86e7-aadae573350f\/operations",
"methods": [
"GET",
"POST",
"DELETE",
"OPTIONS"
]
},
{
"rel": "self",
"uri": "http:\/\/smisdev.mydomain.com\/polling\/v1\/f9f471c9-4c3f-403a-86e7-aadae573350f",
"methods": [
"GET",
"POST",
"PUT",
"OPTIONS"
]
},
{
"rel": "stores",
"uri": "http:\/\/smisdev.mydomain.com\/polling\/v1\/f9f471c9-4c3f-403a-86e7-aadae573350f\/stores",
"methods": [
"GET",
"PUT",
"POST",
"DELETE",
"OPTIONS"
]
}
]
}
 

TomBascom

Curmudgeon
Do a little string manipulation to add the missing outer object. Something like:

JSONdata = substitute( '~{"ProDataSet": &1 ~}', JSONdata ).

should do the trick.
 
Thanks Tom, I finally figured out that if I cast oEntity (the JSON response) to a JsonObject then I could access the properties directly:

Code:
oJsonObject = CAST(oEntity, Jsonobject). 
myrequestID = oJsonObject:getJsonText("requestId").

/* and read the _links into an array */

 DEF VAR oJsonArray  AS JsonArray         NO-UNDO.
oJsonArray  = oJsonObject:GetJsonArray('_links').
 
Top