As you are using .NET 2.0, you need to use the James JSON library, loaded into Codeplex (version for .NET 2.0).
Json.NET example
Add a link to Newtonsoft.Json and Import Newtonsoft.Json in your class.
Example:
Import Newtonsoft.Json Dim product As New Product() product.Name = "Captopril" product.Expiry = New DateTime(2008, 12, 28) product.Price = 3.99D product.Sizes = New String() {"Small", "Medium", "Large"} 'Call SeralizeObject to convert the object to JSON string' Dim output As String = JavaScriptConvert.SerializeObject(product)
The output variable will contain the value:
{ "Name": "Captopril", "Expiry": "\/Date(1230375600000+1300)\/", "Price": 3.99, "Sizes": [ "Small", "Medium", "Large" ] }
source share