JSON对象:
{
"test1":"2",
"test2":"4",
"test3":"5"
}
我需要将"test2":"4"
替换为"test2":"this is test"
。
我如何用Java做到这一点?
答案 0 :(得分:0)
我需要将
"test2":"4"
替换为"this is test"
字符串。我怎么能用java做这个?。
使用String API
,例如使用String::replace
,请记住:
String result = yourJsonString.replace("\"test2\":\"4\"", "\"test2\":\"this is test\"");
答案 1 :(得分:0)