Monday, 19 August 2013

How do I removing backslashes from a JSON string?

How do I removing backslashes from a JSON string?

I have a JSON string that looks as below
'{\"test\":{\"test1\":{\"test1\":[{\"test2\":\"1\",\"test3\":
\"foo\",\"test4\":\"bar\",\"test5\":\"test7\"}]}}}'
I need to change it to the one below using Ruby or Rails:
'{"test":{"test1":{"test1":[{"test2":"1","test3":
"foo","test4":"bar","test5":"bar2"}]}}}'
I need to know how to remove those slashes.

No comments:

Post a Comment