我有这样的json
{
"class":".Instance",
"id":$karishma,
"dbVersion":0,
"instanceName":"IFS_Test_Api",
"definitionId":$value(DefinitionId),
"alertMessage":"Api testing",
"lifetime":"P1D",
"startDate":"2019-04-26T11:39:58.595Z",
"stopDate":null,
"status":"Initial",
"resultAlertId":0,
"ownerIdentifier":"karishma.shaik@infor.com",
"ownerDisplayName":"Karishma Shaik"
}
由于id值$
,"
json无效,因此如何从json中转义这些特殊字符。
if (variableStringValue.contains("$") && variableStringValue.contains("")) {
String value = variableStringValue.replace("$", "");
}
我试图这样做,但不知道如何从"
逃脱String
。
并且我还尝试了StringEscapeUtil
类
json生效