Loading problem…
Implement a full-featured JSON parser capable of processing deeply nested structures, complex character escaping, and varied whitespace configuration.
Building a robust parser requires implementing a recursive descent state machine that can tokenize input strings accurately. This challenge tests your ability to handle non-trivial edge cases such as escaped quotes, multi-line strings, and deep structural hierarchies that push the limits of recursive execution.
number (including integers, floats, and negative values), string, boolean, and null from valid JSON formatting.\\\" to " and \\\\ to \ inside string literals. , \n, \r, \t) found between tokens and property definitions.eval(), new Function(), or the native JSON.parse() method.// 1. Complex Escaping
parse('"path: C:\\\\\\\\Users\\\\\\\\John"');
// Result: "path: C:\\Users\\John"
// 2. Deep Nesting
parse('{"a": {"b": {"c": 1}}}');
// Result: { a: { b: { c: 1 } } }
// 3. Whitespace & Mixed Types
parse(`{
"status": true,
"data": [1, null, "foo"]
}`);
// Result: { status: true, data: [1, null, "foo"] }