qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A brief look at deprecating our JSON extensions over RFC 8259


From: Paolo Bonzini
Subject: Re: A brief look at deprecating our JSON extensions over RFC 8259
Date: Mon, 22 Feb 2021 19:06:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0

On 22/02/21 18:54, Daniel P. Berrangé wrote:
These are sent to QEMU as double-quoted strings (the single-quoted JSON is
parsed to get interpolation and printed back; commit 563890c7c7, "libqtest:
escape strings in QMP commands, fix leak", 2014-07-01). However, doing the
interpolation requires a parser that recognizes the single-quoted strings.

IMHO this is the wrong solution to the problem.  Consider the equivalent
libvirt code that uses a standard JSON library underneath and has a high
level API to serialize args into the command

       qemuMonitorJSONMakeCommand("qom-get",
                                  "s:path", id,
                                 "s:property", "temperature");

Of course this example is reasonably easy since it is a flat set of
arguments. Nested args get slightly more complicated, but still always
preferrable to doing string interpolation IMHO.

I don't disagree. I'm just stating why I wanted a clarification from Markus.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]