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

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

c# - Avoiding duplicate methods for Task and Task<T> -

javascript - Which segment of a polyline was clicked? -