Free the parser only when needed
Fix json emission