I want to save this object:
Student s = new Student();
to Json file. But Visual Studio 2012 can't find none of these namespaces:
System.Web.Script;
System.Json;
System.Runtime.Serialization.Json;
Any idea?
If you want to serialize class into Json you can try this one too:
Install JSON.NET if you haven't yet.
make sure to include using Newtonsoft.Json;
and you can try this code:
Student s = new Student();
string json = JsonConvert.SerializeObject(s);
sorry for my bad english.
Step 1: Google "System.Runtime.Serialization.Json Namespace" and find this page:
System.Runtime.Serialization.Json Namespace
Step 2: Click on the class you are interested in ( let's say JsonReaderWriterFactory Class )
Step 3: Read the part that says what assembly that class is in:
Assembly: System.Runtime.Serialization (in System.Runtime.Serialization.dll)
Step 4: Add that DLL as a reference to your project. See: How to: Add or Remove References By Using the Add Reference Dialog Box
Step 5: Repeat Steps 1 - 4 as needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With