title: Replacing JSON string with another string in java
body: <pre><code>String str = "{"id":"4ebd7e4f","start_page_ui_id":"","business_unit":["5b65aced"],"props":{"metadata":"[]","postsPerPage":"20","network_id":"1b375ffd"},"render_engine":"twig"}"
  </code></pre>
  
  <p>Here I want to replace "metadata":"[]" to "metadata":"["key":"value,value1","key1":"value2"]"</p>
  
  <p>for this i tried to replace as</p>
  
  <pre><code>str =str.replace("\"metadata\":\"[\"", "\"metadata\": \"[{\"key\":\"key\",\"val\":\"value,value1\"},{\"key\":\"key1\",\"val\":\"value2\"}");
  </code></pre>
  
  <p>But it is not getting replaced. I don't understand why??
  Can any one please help me to solve this issue.</p>
  
  <p>I want to replace another string "postsPerPage":"20" to "postsPerPage":"6"</p>
  
  <p>for this i tried with</p>
  
  <pre><code>str = str .replace("\"postsPerPage\": \"20\",", "\"postsPerPage\": \"9\",");
  </code></pre>
  
  <p>Here also the value is not changing.</p>