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