JSON error catch

Catch JSON serialization error and print it in the console.