Synonym for
objectWithKey. The
.: operators can be
chained.
>>> let json = "{\"key1\": {\"nested-key\": 3}}"
>>> parseByteString ("key1" .: "nested-key" .: integer) json :: [Int]
> [3]
It works both as a standalone parser and as a part of
objectOf
parser
>>> let test = "[{\"name\": \"test1\", \"value\": 1}, {\"name\": \"test2\", \"value\": null}, {\"name\": \"test3\"}]"
>>> let person = objectOf $ (,) <$> "name" .: string <*> "value" .: integer .| (-1)
>>> let people = arrayOf person
>>> parseByteString people test :: [(T.Text, Int)]
[("test1",1),("test2",-1),("test3",-1)]