Working with the return json data #1721
|
I will preface this with "I am an extreme newbe" coming from VB and local datasets using ODBC connections. My question is, in DAB the data is contained in the values array. Whereas in most rest examples I see, it is not. So using the C# lets say how do I get the returned array into an array variable inside of C#? Can you provide me an eaxmple. |
Replies: 1 comment 1 reply
|
Hi BumpaRoy, |
Hi BumpaRoy,
Thank you for your question!
You can define a class that represents the response (e.g.
ResponseData) withvalueas an array of objects property. Then deserialize the response from DAB into an object of theResponseDataclass from which you can then access thevalueproperty.Example of deserialization is here: https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/how-to?pivots=dotnet-8-0#deserialize-from-utf-8 where you can replace the
WeatherForecastclass with yourResponseDataclass.