I have this JSON flat file and I need to change the value of clientCode
{
  "clientNumber": "Test",
  "clientCode": "12345",
  "clientReference": "JSON Testing",
  "billingCode":"90code",
  "clienttructure": "new, test, Java",
  "site": "sampleStore",
  "siteDestination": "EU",
}
I tried to change clientCode value and check the return of the method.
I'm Using Java
String jsonName = "clientCode ";
String jsonValue = "new Value";
String JSONSource = path;
public String put(String jsonName, String jsonValue, String JSONSource) {
        String jsonString = null;
        try {
            Object obj = parser.parse(new FileReader(JSONSource));
            org.json.simple.JSONObject jsonObject = (org.json.simple.JSONObject) obj;
            jsonObject.put(jsonName, jsonValue);
            jsonString = jsonObject.toJSONString();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return jsonString;
    }
Actual output is:
{ "billingCode":"90code", "clientCode": "new Value","clientNumber": "Test","clientReference": "JSON Testing",.....}
Expected output should be :
{
  "clientNumber": "Test",
  "clientCode": "new Value",
  "clientReference": "JSON Testing",
  "billingCode":"90code",
  "clienttructure": "new, test, Java",
  "site": "sampleStore",
  "siteDestination": "EU",
}
 
     
    