I have a large object in C# that i would like to write (serialize) to a .json file. I then want to read this .json file and be able to deserialize this object in javascript in order to display it on a website (after formatting it further in javascript). Can anyone tell me how i can achieve this serialization and deserialization to and from a properly formatted json file? Ive tried a few approaches but cant seem to achieve a tree like object structure in outputted file.
Thanks
If you are in a WebService you can set the [ScriptService] tag on your methods. If you are in a winforms or some other kind of app and need to use just serialize an object, you can tag your class serializable and then you can use the JavaSciptSerializer:
In a method: