JSON: abstract error reporting away