Skip to main content

Practice ยท 1 of 3

Safe JSON Parse

Write safeParse(json, fallback) that RETURNS the parsed value when json is valid JSON, and RETURNS fallback when it is not. It must never throw, whatever the input.

Difficulty: intermediate

Back to lesson: Practice: Error Handling โ€” Practice