[Omaha.pm] pretty JSON

Jay Hannah jay.hannah at iinteractive.com
Fri Jun 24 13:07:46 PDT 2011


Cool. I've been using   xmllint --format   to make XML pretty for years. JSON::XS ships with json_xs, which does the same thing for JSON.

BEFORE:
[{"body":{"general":{"date_discontinued":"","is_assembly":false,"is_hidden":false,"description":{"en":"LAMP EMD 75...

AFTER:
[
   {
      "body" : {
         "cost" : {
            "default_rate" : "W",
            "week_price" : {
               "USD" : 0
            },
            "day_price" : {
               "USD" : 0
            }
         },
         ...

This is also handy for piping web service URLs to my human eyeballs:     :)

   curl 'http://foo.bar/baz' | json_xs

Jay Hannah
Senior Developer / Consultant
http://www.iinteractive.com
Email: jay.hannah at iinteractive.com



More information about the Omaha-pm mailing list