I am trying to convert a JSON format into Java code using JSONObject and JSONArray, but I am facing difficulties in getting the output in the desired format. The JSON format is provided 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}
]
}
]
I would appreciate any guidance on how to create this json object in Java as I intend to use it for building a multibar graph using NVD3. Thank you in advance for your help!