how to save an arbitrary string of HTML to a Json file. for example

{ "id": 1, "html": " style type = \"text/css\" " } 

There are problems with screening. How to avoid them?

    1 answer 1

    how to save arbitrary HTML string to json file

     #r "E:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\v2.3\ref\Newtonsoft.Json.dll" using Newtonsoft.Json; using Newtonsoft.Json.Linq; var o = JObject.Parse("{'id':1}"); o["html"] = JToken.FromObject("<div>\"hello\"</div>"); System.IO.File.WriteAllText(@"c:\temp\json.txt", o.ToString()); 

    outputs to file:

     { "id": 1, "html": "<div>\"hello\"</div>" }