Boris Pluimvee Boris Pluimvee - 1 year ago 230
JSON Question

How can I Parse Json in a Azure Function

"I have create a Azure Function in this function I call an API that returns JSON. I want to parse this JSON to an object so I can use it in the function. I cannot not use Newton.JSON as the function seems not to know this.
How can I parse the JSON?"

Answer Source

In the Azure Function your first you need to add a reference to NewtonSoft.JSON. You can do this via "Newtonsoft.Json". Do not forget the quotes!!!

Than you can use the normal serialization via newtonsoft:

var response = await client.GetAsync("<url>");
var json = await response.Content.ReadAsStringAsync();
var o= JsonConvert.DeserializeObject<"Type">(json);