//Deserializes a json string into an object
Target object = javascriptconvert. deserializeobject (JSON string,Typeof(Target object ));
//Serialize the target object into a JSON string
StringJSON string = javascriptconvert. serializeobject (target object );
Product =NewProduct ();
Product. Name ="Apple";
Product. Expiry =NewDatetime (2008,12,28);
Product. Price =3.99 m;
Product. Sizes =New String[] {"Small","Medium","Large"};
StringOutput = javascriptconvert. serializeobject (product );
// {
// "Name": "apple ",
// "Expiry": new date (1230422400000 ),
// "Price": 3.99,
// "Sizes ":[
// "Small ",
// "Medium ",
// "Large"
// ]
// }
Product deserializedproduct = (product) javascriptconvert. deserializeobject (output,Typeof(Product ));
StringJsontext ="['Json! ', 1, true, {property: 'value'}]";
Jsonreader reader =NewJsonreader (NewStringreader (jsontext ));
Console. writeline ("Tokentype \ t \ tvaluetype \ t \ tvalue");
While(Reader. Read ())
{
Console. writeline (reader. tokentype +"\ T"+ Writevalue (reader. valuetype) +"\ T"+ Writevalue (reader. Value ))
}