Hi,
I am trying to call a Rest web service, which returns response in the form of a json
"Result": [
{"id":"1", "firstname":"xyz"},
{"id":"2", "firstname":"abc"}
]
I have created a dotnet dll and imported it into navision.
I use the ApiResult := JsonConvert.DeserializeObject(Json,GETDOTNETTYPE(ApiResult)); to deserialize the Json where ApiResult is set to the rootObject.
How can I store the result in an array or list and access it in C/AL?
1
Answers
JToken := JToken.Parse(Json);
ResultList := JToken.SelectToken('Result');
Then I just loop through the ResultList to get values. This approach works fine.
But I am still not able to use the Deserialize Json.
I have been referring to this blog as well https://www.ctrlshiftf4.com/2017/05/17/consume-openweather-rest-api-in-dynamics-nav/ which has been quite helpful for starters.
But the structure of the json is just a single object and not many objects.
How you do loop through the ResultList to get values??
https://www.kauffmann.nl/2017/06/24/al-support-for-rest-web-services/