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. > > ===================== using StringList > '*unicast': ['String'], > '*multicast': ['String'] > > { > "return": [ > { > "name": "virtio-net-pci.0", > "multicast": [ > { > "str": "01:80:c2:00:00:21" > }, > { > "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. > }, > .... > ] > } > ======================== using strList > '*unicast': ['str'], > '*multicast': ['str'] > > Eric, is it expected format? > > { > "return": [ > { > "name": "virtio-net-pci.0", > "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. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature