Adding better sample code for safely checking the JSON data