I have a JSON response like this
"3928593-236523632-2353253"
after posting some data to a api.
I am trying to assign that response to a variable.
For example var x = data; (where data is the variable set for the https response in a request call)
but this is giving a error
Now usually i would expect something like
[{test: '2352532352352'}]
and i could of cousre go var x = data.test;
When its not like this, how can i attribute the data to a variable?
Thanks
Sounds like your just getting a JSON encoded string back as the response, which is totally valid JSON.
let response = JSON.parse('"3928593-236523632-2353253"');
and now
response === "3928593-236523632-2353253"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.