fix json_compat to raise same errors as json gem