fastjson 构建和解析json对象

maven依赖:

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>fastjson</artifactId>
    <version>1.2.66</version>
</dependency>
		//构建 json 对象
		JSONObject jsonObject = new JSONObject();
        jsonObject.put("market","SH");
        jsonObject.put("symbol","000001");
        jsonObject.put("price",1000);
        System.out.println(jsonObject.toJSONString());
        //解析 json 字符串
        JSONObject obj = JSONObject.parseObject(jsonObject.toJSONString());	
发布了41 篇原创文章 · 获赞 0 · 访问量 792

猜你喜欢

转载自blog.csdn.net/weixin_37562241/article/details/104620770
今日推荐