lib/json: add error checking in the json deserialization example