JSONObject转换为Map(String, Integer)对象

1. 示例代码

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;

JSONObject obj = new JSONObject();
{
	obj.put("key1", "value1");
	obj.put("key2", "value2");
	obj.put("key3", "value3");
}
Map params = JSONObject.parseObject(obj.toJSONString(), new TypeReference>(){});
System.out.println(params);

//输出:{key3=value3, key2=value2, key1=value1}

List   flowoutList = JSONObject.parseObject(v, new TypeReference>() { });

2. 依赖


    com.alibaba
    fastjson
    1.2.61

你可能感兴趣的:(Java,spring,json,spring,boot)