title: Updating multiple values of different keys in map using java
body: <p>I have converted a JSON file to a map and I need to modify multiple values of different keys at once using JAVA.</p>
  
  <p>Following is the map converted JSON file:</p>
  
  <pre><code>{
      "name": "",
      "numberID": null,
      "StartDate": "",
      "EndDate": "",
      "count": null,
      "level": null,
      "discipline": null,
      "paymentModel": null,
      "ownerName" : null,
      "coursepackType": null,
      "note": null
  }   
  </code></pre>
  
  <p>I need to update multiple values at once from above JSON, I want to add value to following keys:</p>
  
  <ul>
  <li>name</li>
  <li>StartDate</li>
  <li>EndDate</li>
  <li>count</li>
  <li>ownerName</li>
  </ul>
  
  <p>All I have write now is way to update just single value, which is already pretty linear: 
  Using following series of functions:</p>
  
  <pre><code>String body="";
  File testDataJsonfile = new File("path/xxx.json");
          JsonNode testJSONNodes = getJsonNodes(testDataJsonfile);
          Map&lt;String, Object&gt; mapWithJSONNodes = convertJSONTOMAP(testJSONNodes);
          body = updateValue(mapWithJSONNodes, "name", "abc")
  
  public String updateValue(Map&lt;String,Object&gt; map ,String key,String value) throws JsonProcessingException{
              map.put(key, value);
              String convertedJSONFile = new ObjectMapper().writeValueAsString(map);
              return convertedJSONFile;
          }
  </code></pre>
  
  <p>Any way to to achieve what I want dynamically, probably passing an array list or so?
  Please let me know if any other specification is required.  </p>