I have a JSON object as follows
{
"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"
}
I need to remove "jsonErrorResponse":{"errorCount":0,"errors":[]},
I used JSONobject.remove("jsonErrorResponse").toString()
But it gave me output as {"errorCount":0,"errors":[]} instead of
{
"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",
"currency":"USD",
"company":"GB0010001"
}
removemethod. And then take a look at yourJSONObjectafter youremoved the"jsonErrorResponse".