Safety check before parsing JSON