From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US58t-00013V-La for qemu-devel@nongnu.org; Tue, 16 Apr 2013 08:37:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1US58o-0004rH-QI for qemu-devel@nongnu.org; Tue, 16 Apr 2013 08:37:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24255) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US58o-0004rD-IV for qemu-devel@nongnu.org; Tue, 16 Apr 2013 08:37:42 -0400 Message-ID: <516D45D6.5010605@redhat.com> Date: Tue, 16 Apr 2013 06:36:38 -0600 From: Eric Blake MIME-Version: 1.0 References: <8738urblx3.fsf@fimbulvetr.bsc.es> <20130416084919.GG6308@stefanha-thinkpad.redhat.com> <516D11E0.3000700@redhat.com> <20130416101322.GA9337@t430s.nay.redhat.com> In-Reply-To: <20130416101322.GA9337@t430s.nay.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2AUKCMICMSLSMXMWIVLUQ" Subject: Re: [Qemu-devel] [qapi] Cannot use list of strings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong Cc: Anthony Liguori , Michael Roth , Stefan Hajnoczi , qemu-devel@nongnu.org, Luiz Capitulino , Paolo Bonzini , =?UTF-8?B?TGx1w61zIFZpbGFub3Zh?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2AUKCMICMSLSMXMWIVLUQ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 04/16/2013 04:13 AM, Amos Kong wrote: > Eric said String list contains additional JSON structure. > At least, it works. Using the fat 'String' wrapper works, but requires more effort to decode.= >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D using S= tringList > '*unicast': ['String'], > '*multicast': ['String'] >=20 > { > "return": [ > { > "name": "virtio-net-pci.0",=20 > "multicast": [ > { > "str": "01:80:c2:00:00:21" > },=20 > { > "str": "00:00:00:00:00:00" > } > ] Libvirt can live with this, even though it is more work, if you can't figure out how to make 'str' work. I don't know enough about the JSON generator to quickly dive in and figure out why you can't make an array of native types, though. > },=20 > .... > ] > } > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= using strList > '*unicast': ['str'], > '*multicast': ['str'] >=20 > Eric, is it expected format? >=20 > { > "return": [ > { > "name": "virtio-net-pci.0",=20 > "multicast": [ > "str": "01:80:c2:00:00:21", > "str": "00:00:00:00:00:00" > ] No. This is not valid JSON. ':' is only allowed inside {}. The point of an array is to either have an array of objects (as in [ {'name':value}, {'name':value} ]) or an array of native types (as in [ value, value ]). The ideal solution is for the output QMP to look like: "multicast": [ "01:80:c2:00:00:21", "00:00:00:00:00:00" ] which seems like it should work as '*multicast':['str'], if you can figure out how to make the generator play along. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2AUKCMICMSLSMXMWIVLUQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRbUXWAAoJEKeha0olJ0NqGtYIAKB4xaEVAkD1wd7J3KviTo1X iqR2hh1Qr74n1IISBKyfGiv5x7Dz/ci8lVUEmiH1wYwkILK9cX/UvFN93g79jMkQ JjTYmp323RXXOOOWpN7a2gAHjhcbn+2JXoSO2cYU40GXr6zgR3JMbwKH+9/M15u2 4w+cT21zbAnp6EDZc4tllB6DuywqBvKtjwJZCvT1D9ZGFosz4KF2CvQeegPK8WRI Bd9ARmM+IjKQ1H1OF4Sm6hSIREcqsrjEd56QjvzJWyiopog3lnNXGOmfurVBRX7Z VGDK9E5TWVT0a41ttHwjAloShahArMauKLl0bg8nbij8g7ezOZlUejeqSEaoV7k= =fWLg -----END PGP SIGNATURE----- ------enig2AUKCMICMSLSMXMWIVLUQ--