Help with deserializing PI Web API responses in c#

Hi,

Admittedly, I'm not a full time programmer. I need to query for and retrieve data using the PI Web API in a c# (.NET) environment. My trouble is with deserializing the returned JSON payloads, or simply mapping them to a .NET data structure. When the response is simple, like with the system/userinfo - no problem. When it's a return of say plotvalues, then it's more troublesome (for me). I think i'm just not defining the class data structures correctly, as it's an array of objects. I can no longer find the whitepaper on PI Web API (which is supposed to have c# examples) and the NUGET PIWebAPIClient seems to be gone now too. Could someone please share a few lines on deserialization or converting to a .NET object and maybe an example class data structure? I'm assuming everyone using c# has to do this on their own. I've been using the NewtonSoft.JSON package and something like this: JsonConvert.DeserializeObject<AnalogPointStream>(json); where AnalogPointStream is my class of the data structure for the streams controller return of plot values, and json is the string from the reader of the request.

If anyone has the whitepaper on PI Web API that would be great to have shared. Hopefully this makes sense. Thanks! Keith

Parents Reply Children