Javascript: JSON

(Last Updated On: )

This post shows you how to parse string to json and then back again.

String to Json

  1. var doc = null;
  2. try {
  3. doc = JSON.parse(value);
  4. }
  5. catch(ex) {
  6. //handle exception
  7. }

Json to string

  1. JSON.stringify(value));