JSON和类之间的转换
2015-12-17 10:44
1261 查看
using LitJson;
using System.Collections.Generic;
using System;
using System.Linq;
using System.Text;
public class Coding<T>{
//转字符串
public static string encode(T model){
return JsonMapper.ToJson(model);
}
//转JSON
public static T decode(string message){
return JsonMapper.ToObject<T>(message);
}
}
using System.Collections.Generic;
using System;
using System.Linq;
using System.Text;
public class Coding<T>{
//转字符串
public static string encode(T model){
return JsonMapper.ToJson(model);
}
//转JSON
public static T decode(string message){
return JsonMapper.ToObject<T>(message);
}
}
相关文章推荐
- jsoncpp解析 json对象
- 我自己的Javascript 库,封装了一些常用函数
- 关于<:if>没有<c:else>解决方案
- [No000069]Javascript中this关键字详解
- JS 数据类型转换和数据有效性判断
- js使用正则查找子串
- js中利用window.open()打开带参数的链接问题
- 运用iscroll.js遇到的问题
- hackermi javascript 修改css样式
- js倒计时简单实现方法
- JavaScript之解释与执行
- struct2 与jsp交互
- JS表单原生验证器
- jsp引入jsp或者js
- JS函数的几种定义方式分析
- js实现文字闪烁特效的方法
- 浅谈json转c#对象
- JavaScript基础(2):什么是“闭包”?
- javascript动态获取当前页面的url
- 《Effective JavaScript》- 1.5 避免对混合类型使用 == 运算符