user2016193
user2016193

Reputation: 127

Decode a JSON String in Javascript

I have a encoded JSON string returning the following sting which I am displaying on my webpage from a database call.

{"Value 1":"1234","Value 2":"123456"}

How do I decode this string and also format the data to be displayed in a table?

I am at a lost as how to do this. Thanks

Upvotes: 0

Views: 83

Answers (1)

Timur Osadchiy
Timur Osadchiy

Reputation: 6209

Here is how to turn a string containing a JSON into an object:

JSON.parse('{"Value 1":"1234","Value 2":"123456"}');

Upvotes: 2

Related Questions