kindly i want to convert this string to Json using javascript
Result = {"result":"{\"Response\":\"Success\"}"}
i firstly use
Result=Result['result']
and i have this
Result= '{"Response":"Success"}'
please your help to continue
1 Answer 1
You can use JSON.parse
The JSON.parse() method parses a string as JSON, optionally transforming the value produced by parsing.
Result = {"result":"{\"Response\":\"Success\"}"};
Result = JSON.parse(Result['result'])
answered Sep 27, 2016 at 6:31
Vladu Ionut
8,2231 gold badge24 silver badges30 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-js
JSONis already aStringhence "Convert String to JSON using Javascript" is wrong title..'{"Response":"Success"}'isJSONhenceString, to convert it asObject, UseJSON.parse(YOUR_JSON)