On 03/08/20 13:36, Daniel P. Berrangé wrote:
>>> Given that QEMU needs to pass
>>> uint64 values, JSON was simply the wrong choice of format for QMP.
>
> I wasn't refering to RFC7159. The problem of undefined integer precision
> with JSON came up right at the very start when QMP was first designed and
> implemented, and has come up again periodically ever since then. libvirt
> needed to do workarounds right at the start in 2009, in order to fully
> handle signed/unsigned 64-bit integers with QMP.

I assume the workaround you refer to is to store the number as a string
and converting it lazily to either an integer or a floating-point type
in whoever uses the JSON API.  It may not be pretty but probably it
would have been the same for any text-based, schema-less protocol.  For
example, it didn't require writing your own parser.

It could be avoided by using a schema in Libvirt, just like QEMU has no
problem with it on the other side; it's just a different design choice
with different trade-offs, I don't think it's enough of an issue to
declare JSON "the wrong choice of format for QMP".

Paolo


Reply via email to