ensuring the JSON parsing and serialization is more robust and pretty printed