3 回答
TA贡献1824条经验 获得超5个赞
JSONobject.remove("jsonErrorResponse")返回被移除的东西。您正在调用toString您刚刚“删除”的部分。
简单地不要链接方法调用。
JSONobject.remove("jsonErrorResponse");
String newJson = JSONobject.toString()TA贡献1841条经验 获得超3个赞
由于您正在处理,因此JSONobject您正在从该对象中删除内容。
您需要调用toString().JSONobject
String str = "{\"mandator\":\"GB0010001\",\"debitAccount\":\"81884\",\"creditAccount\":\"82918\",\"trustedBeneficiary\":\"false\",\"localCurrencyAmount\":35,\"transactionReference\":\"omega7.1.1\",\"debitAccountASPSP\":\"t24\",\"currencyAmount\":35,\"executionDate\":\"20180102\",\"creditAccountASPSP\":\"t24\",\"transactionType\":\"Contactless payment\",\"trustedPSP\":\"false\",\"jsonErrorResponse\":{\"errorCount\":0,\"errors\":[]},\"currency\":\"USD\",\"company\":\"GB0010001\"}"
JSONObject jsonObject = new JSONObject(str);
jsonObject.remove("jsonErrorResponse");
jsonObject.toString();
添加回答
举报
