Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

JSON_toJSONString_cn

wenshao edited this page May 5, 2016 · 2 revisions

将java对象序列化为JSON字符串,fastjson提供了一个最简单的入口

package com.alibaba.fastjson;

public abstract class JSON {
    public static String toJSONString(Object object);
}

Sample

import com.alibaba.fastjson.JSON;

Model model = new Model();
model.id = 1001;

String json = JSON.toJSONString(model);
Clone this wiki locally