Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert string to json array

I get this response from an Ajax request. Javascript seems to intepret it as a string. (When I say alert this.responseText, the whole string is shown)

How can i convert it to a javascript object (JSON)?

{"response": {
   "success": "The activity has been removed",
   "message": "0"

  }
}

I am not using jquery.

like image 296
robert Avatar asked Nov 29 '22 17:11

robert


1 Answers

If you use jQuery, JSON.parse(this.responseString); or jQuery.parseJSON(this.responseString); should work.

like image 179
knepe Avatar answered Dec 05 '22 05:12

knepe