Page: [root]/code/hjpath | src | faq | css

hjpath

Hjpath is Haskell library for XPath-like queries on JSON code. It's based on hjson library.

Currently supported features:

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.

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:

jPath [ArrayLookup 2] "[1,2,3]" -- ["3"]

For more info, refer to docs on hackage.

Get it


Powered by bitcheese wiki engine