On Thursday, 23 November 2017 17:07:34 CET Eric Blake wrote:
On 11/23/2017 07:23 AM, Pino Toscano wrote:
> While YAJL mostly works fine, it did not see any active development in
> the latest 3 years. OTOH, Jansson is another JSON C implementation,
> with a very liberal license, and a much nicer API.
>
> Hence, switch all of libguestfs from YAJL to Jansson:
> - configure checks, and buildsystem in general
> - packages pulled in the appliance
> - actual implementations
> - contrib scripts
> - documentation
>
> This also makes use of the better APIs available (e.g. json_object_get,
> json_array_foreach, and json_object_foreach). This does not change the
> API of our OCaml Yajl module.
>
> The only behaviour change is that Jansson by default accepts only
> objects and arrays as input (even though it has a flag to make it accept
> anything). Since this seems a good idea anyway, and as it is the RFC
> behaviour, then change one of the yajl_tests checks accordingly.
Which RFC?
RFC 4627 stated that only objects or arrays could occur at the top
level. But it was superseded by:
RFC 7159, which states that ANY json value can be the top level of the
grammar.
RFC 4627 is what the Jansson documentation points to.
So maybe it's better to set the flags and always allow all
objects.
All in all, considering all the JSON inputs parsed so far are either
objects or arrays, IMHO it would be a good idea to still parse in
"strict mode", and in case enable other types only where needed.
--
Pino Toscano