Added simple error handling for nested or failed JSON