0

I have already existing JSON file similiar to this:

[{
    "x": []
}]

and I want to put prepared JSON Array as a value for "x" key. How to do it using JSON Simple library?

1 Answers1

0

Quick solution:

    JSONObject jsonObject = (JSONObject) jsonArray.get(0);
    jsonObject.put("x", jsonArrayWithValueForXKey);
    jsonArray.clear();
    jsonArray.add(jsonObject);