public TestClass JsonToClass(string jsonstr)
TestClass testClass= JsonConvert.DeserializeObject<TestClass >(jsonstr);
return testClass;
public T JsonToObject<T>(string jsonstr)
T obj = JsonConvert.DeserializeObject<T>(jsonstr);
return obj;
type data struct {
ExpireTime string `json:"expire_time"`
Token string `json:"token"`
type Authorization struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data data `json:"data"`
var authorization Authorization
json.Unmarshal(b
var tmp = BitConverter.ToInt32(new byte[]{...});
var bytes = BitConverter.GetBytes(tmp);
而String转byte[]和转回要用Encoding。
转载于:https://www.cnblogs.com/hont/p/4273017.html...
顶部添加引用using Xfrog.Net;
用法如: JsonObject newObj1 = new JsonObject("json字符串");
String errorCode = newObj1["error_code"].Value;//获取其中的属性值。
string status = newObj1["result"]["status"].Value;