Improve error handling of json_loads.

Signed-off-by: Thiago Farina <tfarina@chromium.org>