2

私はJava http://json.org/java/のJSONの初心者です

このような JSON オブジェクトを作成するにはどうすればよいですか?

{
    "RECORD": {
        "customer_name": "ABC",
        "customer_type": "music"
    }
}
4

2 に答える 2

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() );
于 2013-10-31T05:31:28.333 に答える