Boris Pluimvee Boris Pluimvee - 5 months ago 50
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

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);
Comments