Clarity

 View Only

JSON and Escape characters

  • 1.  JSON and Escape characters

    Posted Oct 06, 2023 07:56 AM

    I would like to ask you for advice.

     I need to update Clarity string attribute with value in different clarity attribute. To process the data in clarity I use the REST API calls. Means export data using REST API, process data and import data back using REST API.

    For data processing I use the "org.json.JSONObject" class, that transform the output to JSON. But the issue is with escape characters like \n, \t….

    I have checked the output using stringBuilder.toString() method and the output contains the escape characters, but the class org.json.JSONObject removes all the escape characters. I did not find any constructor for this class that can leave ethe escape characters there when cratering from stream output the JSON object.

    Do you have any idea, how to solve this issue? Or is there any other class to not remove the escape characters? Similar to "org.json.JSONObject"?

    Thank in advance for your help

    Milos



    ------------------------------
    Regards
    Milos Simek
    Senior Consultant
    ------------------------------