I have json format which I want to create in java code using JSONObject and JSONArray but I did not get output in proper format. JSON format is as below.
var transaction_Data =
[
{
"key": "PASSED",
"values": [
{"x": "20 June", "y": 30},
{"x": "21 June", "y": 50},
{"x": "22 June", "y": 20},
{"x": "23 June", "y": 60},
{"x": "19 June", "y": 20},
{"x": "24 June", "y": 10}
]
},
{
"key": "FAILED",
"values": [
{"x": "19 June", "y": 50},
{"x": "21 June", "y": 30},
{"x": "20 June", "y": 20},
{"x": "23 June", "y": 70},
{"x": "22 June", "y": 45},
{"x": "24 June", "y": 60}
]
}
]
How can I create this json object in java because I want to use this object for creating multibar graph using NVD3. Any help is greatly appreciated!