我是Java {J}的初学者http://json.org/java/
如何创建这样的JSON对象?
{
"RECORD": {
"customer_name": "ABC",
"customer_type": "music"
}
}
答案 0 :(得分:1)
您必须将“RECORD”设为JSON对象。这是一个例子:
JSONObject json = new JSONObject();
// Add a JSON Object
JSONObject Record = new JSONObject();
Record.put( "customer_name", "ABC");
Record.put( "customer_type", "music");
json.put( "RECORD", Record);
// P toString()
System.out.println( "JSON: " + json.toString() );