阿里JSon开源组件fastjson应用
来源:互联网 发布:淘宝被骗了钱卖家跑路 编辑:程序博客网 时间:2024/06/09 20:34
1:maven配置
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.1.24</version>
</dependency>
2:解析类
public interface Decode<I, O> {
O parseObj(I input, O O);
}
public class DecodeImpl implements Decode<String, Object> {
@Override
public Object parseObj(String jsonStr, Object object) {
Object result = JSON.parseObject(jsonStr, object.getClass());
return result;
}
}
3:实例如下:
PostAction postAction = new PostAction();
String resultStr = postAction.getPostMethod();
ResponseJSon responseJSon = (ResponseJSon) JSON.parseObject(resultStr, ResponseJSon.class);
4:如果ajax前台返回值,可以通过如下把值写入大response中去:
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("text/html;charset=GBK");
response.getWriter().println("hello world!");
- 阿里JSon开源组件fastjson应用
- 阿里fastjson 对象转JSON
- Json应用之FastJson
- 来自阿里的 json 解析方案 fastjson
- 基于阿里fastJson解析json字符串
- 生成JSON数据--fastjson(阿里)方法
- 阿里fastJson几种Json方式
- Json应用案例之FastJson
- 学习开源JSON框架 -- FastJson,Jackson,Gson
- Json解析开源框架--FastJson 的基本使用
- Json---fastJson
- Json-fastjson
- 在 springmvc 中, 如何配置 fastjson (阿里开源的) 和 Jackson( Spring 内置的)
- 阿里fastjson.jar使用
- 阿里的FastJson
- 阿里FastJson的使用
- 快速高效解析json的工具---fastjson应用实例
- 安卓com.alibaba.fastjson.JSON的应用
- Linux shell简介
- B2B行业网站销售部与其它部门如何共享发展成果
- wxWidgets编译注意问题
- linux命令安装mysql
- 随便写写代码--1,java的分页代码
- 阿里JSon开源组件fastjson应用
- Chapter11-"windows线程池"之异步调用函数
- 用ASP.NET编写一个计算器(能实现加减乘除的)
- ASP.NET WEB应用或网站 部署到win2003 IIS信息管理器中
- JQuery中AJAX应用
- 内存字节对齐
- FLEX4.5开发系列知识
- Qt发送http请求
- MacVim 安装 Zen-Coding 插件