How to escape Special Characters in JSON

前端 未结 2 1373
情深已故
情深已故 2021-01-12 00:01

We have a form which has a long paragraph for a scienctific application that contains characters like symbol beta(ß-arrestin) etc. We have a JSON service running on Mule tha

2条回答
  •  独厮守ぢ
    2021-01-12 00:22

    At the target you can receive the data as text/plain.

    Clean it by running :

    input.replaceAll("\\p{Cc}", "").
    

    Convert it back to JSON data using any JSON library :

    JSONObject inputParams = JSONObject.fromObject(input);
    

    Hope it helps.

提交回复
热议问题