JSON object :
{
"test1":"2",
"test2":"4",
"test3":"5"
}
I need to replace "test2":"4"
with "test2":"this is test"
.
How can I do this with Java?
I need to replace
"test2":"4"
by"this is test"
string.How can I do this with java?.
Using String API
, for example with String::replace
, remembering:
You need to scape special characters
String result = yourJsonString.replace("\"test2\":\"4\"", "\"test2\":\"this is test\"");