C# create typed object from anonymous json

99 Views Asked by At

In my code I make a web request and receive back html, I use Jurassic Engine to map that data to a stringified JSON object.

var engine = new Jurassic.ScriptEngine();
var result = engine.Evaluate("(function() { " + output + " return someVariable; })()");

// the JSON data I want to map to a typed model
var json = JSONObject.Stringify(engine, result);

I have a model that matches the response JSON, but I'm not sure how to set the values from the JSON result into a variable of that type.

How can I turn the json data response into typed variable of MyType? Sorry if this is obvious, I am new to C#.

Thanks!

0

There are 0 best solutions below