Micro optimalization for serialisation
Fix checking of valid JSON