Fixed error output for json_encode

Summary: `json_encode` threw a notice instead of setting a json error, this caused several discrepencies including forgotten implementaion of `JSON_PARTIAL_OUTPUT_ON_ERROR`.

Reviewed By: @ptarjan

Differential Revision: D1414389