The following example shows the syntax to use for serializing a script to JSON, outputting a file named source.json.txt:
myScriptDom.Source.SaveAsJson(@"c:\source.json.txt");
The code looks like this example when represented in JSON:
{
"Children" : [
{ "__type" : "CreateResourceStatement:http://mesh.com",
"Request" : {
"__type" : "MeshObject:http://mesh.com",
"Title" : "hello, scripts1"
},
"CollectionUrl" : https://user-ctp.windows.net/V0.1/Mesh/MeshObjects
}, {
"__type" : "CreateResourceStatement:http://mesh.com",
"Request" : {
"__type" : "MeshObject:http://mesh.com",
"Title" : "hello, scripts2"
},
"CollectionUrl" : https://user-ctp.windows.net/V0.1/Mesh/MeshObjects
} ]
}