how to convert a string to an object in Javascript? -


this question has answer here:

i know how convert string below object in javascript:

var string = '{"id":"50","actor":"1","subject":"1","object":"18","message":"a ajout\u00e9","status":"unseen"}' 

in fact, after converting string above object, able access element of object. example, if convert string object called "obj" able access value of element "id" (which "50") in such way: obj.id

thanks in advance.

this string in json.

use

var obj = json.parse(string); 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -