Page: [root]/code/hjpath | src | log | 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


Last edited: Voker57 on 2010-06-07 07:49:39 +0000