I noticed that json_pp was returning data randomly. This is due to a perl internal (http://search.cpan.org/~mlehmann/JSON-XS-3.03/XS.pm)
Perl hash references become JSON objects. As there is no inherent ordering in hash keys (or JSON objects), they will usually be encoded in a pseudo-random order. JSON::XS can optionally sort the hash keys (determined by the canonical flag), so the same datastructure will serialise to the same JSON text (given same settings and version of JSON::XS), but this incurs a runtime overhead and is only rarely useful, e.g. when you want to compare some JSON text against another for equality.
To overcome this you can include these arguments to json_pp:
json_pp --json_opt=canonical,pretty < json.txt