[openstack-dev] [Neutron][API Doc] Easy way to generate JSON output for doc?
Vishvananda Ishaya
vishvananda at gmail.com
Wed Jul 31 23:27:17 UTC 2013
If you need to do anything more interesting with json from the command line I have found the jq tool to be especially useful:
http://stedolan.github.io/jq/
For, example, here is how one might use it to interact with the nova keypairs api:
https://github.com/vishvananda/openstack-examples/blob/master/keypair.jq
Vish
On Jul 31, 2013, at 4:00 PM, "Mellquist, Peter" <peter.mellquist at hp.com> wrote:
> Paul,
> There are a few ways of doing this but I have used curl then pipe the results through a python JSON pretty print tool. This formats the JSON for easily dropping into API docs.
>
> curl ( some Openstack request with JSON output ) | python –mjson.tool
>
> Hope this helps,
> Peter.
>
>
>
> From: Paul Michali [mailto:pcm at cisco.com]
> Sent: Wednesday, July 31, 2013 3:41 PM
> To: OpenStack Development Mailing List
> Subject: [openstack-dev] [Neutron][API Doc] Easy way to generate JSON output for doc?
>
> Hi!
>
> I'm writing API doc pages for VPNaaS and was wondering if there are any tools/scripts to make it easy to generate the needed JSON result output for various operations?
>
> It looks like I can do the neutron command with --verbose to get unformatted JSON output. Should I do that and then reformat the output (or is there way to do that easier)?
>
> I did try to use json.loads() on the RESP: output, but it threw an ValueError "Expecting property name: line 1 column 1 (char 1)"
>
> Ideas?
>
> PCM (Paul Michali)
>
> MAIL pcm at cisco.com
> IRC pcm_ (irc.freenode.net)
> TW @pmichali
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20130731/2a721122/attachment.html>
More information about the OpenStack-dev
mailing list