locked
Replacing double backslash to single backslash in json string

    Question

  • Hi,

    I want to replace double backslash  to single backslash from json string.

    For Ex:

    string value = "{\"a\":\"corp\\shishir.roy\"}";

    Expected Value :

    string value = "{\"a\":\"corp\shishir.roy\"}";

    I want value in json string like "corp\shishir.roy"

    Regards,

    Shishir


    shishir


    • Edited by Shishir42 Wednesday, July 23, 2014 10:40 AM
    Wednesday, July 23, 2014 10:39 AM

Answers

  • Hi Shishir42,

    You can use the replace method to accomplish this.

    Try

    value = value.replace("\\\\","\\");

    Hope this resolves your query.


    Regards, Ram

    Wednesday, July 23, 2014 11:57 AM