2

I would like to know how to convert the string below to an object in Javascript:

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

In fact, I would like that after converting the string above to an object, I will be able to access to any element of that object. For example, if I convert the string to an object called "obj" I will be able to access to the value of the element "id" (which is "50") in such way: obj.id

Thanks in advance.

1

1 Answer 1

4

This string is in JSON.

Use

var obj = JSON.parse(string);
Sign up to request clarification or add additional context in comments.

1 Comment

This must be a duplicate...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.