import com.alibaba.fastjson1.JSON;
import com.alibaba.fastjson1.JSONObject;
public class FastJsonExample {
public static void main(String[] args) {
JSONObject object = new JSONObject();
object.put("name", "Alice");
object.put("age", 18);
String json = JSON.toJSONString(object);
System.out.println(json);
JSONObject jsonObject = JSON.parseObject(json);
String name = jsonObject.getString("name");
int age = jsonObject.getIntValue("age");
System.out.println("Name: " + name);
System.out.println("Age: " + age);
}
}
json
{
"dateFormat": "yyyy-MM-dd HH:mm:ss",
"serializeFeatures": [],
"parserFeatures": [],
"fieldBased": false
}