h1. hjpath Hjpath is Haskell library for XPath-like queries on JSON code. It's based on "hjson":http://hackage.haskell.org/package/hjson library. Currently supported features: * Object and array traversal: @/someobject/somearray[5]@ * Negative indices for starting from array end: @/someobject/somearray[-1]@ for grabbing last entry * * wildcard, matches any object or array element: @/someobject/*/anotherarray/*@ * ==** wildcard==, acts like "//" in XPath, matches any sequence of elements. @**/something@ h2. How to use You can search within any type that is an instance of HJsonLike. Out-of box it works with *String*s and HJson. Results will be in the same format. bc. jPath "[2]" "[1,2,3]" -- ["3"] jPath "wtf" "{\"wtf\": 3}" -- ["3"] jPath "[2]" $ JArray [JNull, JNumber 1, JNumber 2] -- [JNumber (2 % 1)] Since 3.0, you can also avoid string queries and compose them using Haskell: bc. jPath [ArrayLookup 2] "[1,2,3]" -- ["3"] For more info, refer to docs on hackage. h2. Get it * With "cabal-install":http://www.haskell.org/cabal/download.html: cabal install hjpath * Git: "git.bitcheese.net":http://git.bitcheese.net/?a=summary&p=hjpath, "gitorious":http://www.gitorious.org/jpath