Interview practice question
Safely parsing JSON from untrusted sources
Frontend Engineering · JavaScript Core · Intermediate
Your app parses JSON from local storage and URL parameters, and sometimes it crashes. How do you make this robust?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Wrap JSON.parse in try/catch.
- Validate structure (schema, Zod).
- Defaults on failure.
- Avoid prototype pollution keys.
- Version stored data.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.