JSON.parse()

noun

say it: “JAY-sun dot PARSS” /ˈdʒeɪsən dɒt pɑːrs/ or “JAY-sun dot PARS” /ˈdʒeɪsən dɒt pɑːrs/

The JavaScript method that turns JSON text back into a value your code can use, such as an object or a list.

What does JSON.parse() do in JavaScript?

JSON.parse() — A method that converts valid JSON text into a JavaScript value.

const text = '{"item":"tea"}';
const order = JSON.parse(text);

In a sentence

  • “JSON.parse(saved) turned the saved text back into the list of sign-ups so I could loop over it.”
  • “Local storage gave me the playlist back as text, so I ran JSON.parse() to get the list of songs again.”
  • “JSON.parse() threw an error because the saved text was cut off halfway.”

Level: Journeyman · More JavaScript terms at this level

Updated