I don't understand. What did you get and what did you expect?
> Any ideas on how to do this in a better way ?
json_unpack() is too limited for complex validating. JSON Schema is
better, but I'm afraid there are no C libraries for it available.
Petri
Christophe Paris wrote:
> The problem is that the error reported by unpack is related to the element and
> not to the root of the document as I would have expected.I don't understand. What did you get and what did you expect?
> Any ideas on how to do this in a better way ?
json_unpack() is too limited for complex validating. JSON Schema is
better, but I'm afraid there are no C libraries for it available.
The line and column error information refer to the format string, not
to the JSON value. In this case, the format string is "{s:d}". The
line number will almost always be 1, unless your format string
contains \n characters. There are no line numbers or anything like
that associated with a JSON value after it has been successfully
parsed by json_load() or a friend.
Petri