JSON.parse()
JSON.parse() is a JavaScript method in the JSON category. Parses a JSON string into a JavaScript value. The syntax is JSON.parse(text, reviver). A typical example: JSON.parse("{\"a\":1}") // {a: 1}. Another practical use — Parse API response: const jsonStr = '{"user":"Alice","age":25}' const parsed = JSON.parse(jsonStr) console.log(parsed.user) // 'Alice' Its time complexity is O(n), which matters when it runs over large inputs. The TypeScript signature is (text: string, reviver?: (key: any, value: any) => any): any. Common pitfall — Always wrap in try/catch. JSON.parse() throws a SyntaxError on invalid input. Always wrap in try/catch when parsing user-supplied JSON. A close sibling is JSON.stringify(), which converts a JavaScript value to a JSON string. More about this category: JSON methods for data serialization — stringify and parse. Related JSON methods: JSON.stringify(). This page is part of the free JS Reference documentation covering 1027+ methods, each with syntax, parameters, return values, examples, and common pitfalls.