1

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!

Anas Alweish
  • 2,818
  • 4
  • 30
  • 44
Edon
  • 1,116
  • 2
  • 22
  • 47
  • 1
    you'll need to use a json serializer or implement yourself, the most popular one for C# is `Newtonsoft.Json` (https://github.com/JamesNK/Newtonsoft.Json), please try and let us know if you have any problems – Kien Chu Oct 26 '18 at 00:17

0 Answers0