资 源 简 介
Introduction
json-sharp contains 4 methods:
string JSON.Serialize(object o);string object.ToJSON();T JSON.Deserialize(string json);object JSON.Deserialize(string json);
It is of note that only public properties are serialized and deserialized.
Setup
Minimal setup is required to get json-sharp running.
Download either the DLL or the source file.
Include either the DLL or the source file in your project.
Include a using reference to System.Web in the .cs file you intend to use json-sharp if there isn"t one already.
using System.Web;
Examples
Serializing
There are two ways in which you can serialize an object. First of all, you can use the straight-forward Serialize method.
string myJsonString = JSON.Serialize(MyRandomObject);
or you can use the even easier object.ToJSON method.
string myJson