0

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

user2016193
  • 117
  • 1
  • 5
  • 11
  • Google the title of the question, and you'll find the answer – Vlad Preda Apr 10 '15 at 10:55
  • 2
    possible duplicate of [Parse JSON in JavaScript?](http://stackoverflow.com/questions/4935632/parse-json-in-javascript) – Vlad Preda Apr 10 '15 at 10:55
  • 1
    What you appear to have in your question is already an object, which does not require any decoding. – Rory McCrossan Apr 10 '15 at 10:57
  • There are lots of tutorials on how to create html from json. This post will also be very helpful http://stackoverflow.com/questions/11922383/access-process-nested-objects-arrays-or-json – charlietfl Apr 10 '15 at 12:04

1 Answers1

2

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

JSON.parse('{"Value 1":"1234","Value 2":"123456"}');
Timur Osadchiy
  • 5,699
  • 2
  • 26
  • 28