1{-# LANGUAGE OverloadedStrings #-}
5import Control.Monad (unless)
7import qualified Data.Aeson.Pointer as P
11 -- JSON Pointers must either be empty or start with a /.
12 pntr1 <- case P.unescape "/foo/0" of
13 Left _ -> error "Failed to construct JSON Pointer."
14 Right pntr -> return pntr
16 -- We can also write JSON Pointers in Haskell.
17 let pntr2 = P.Pointer [P.Token "/"]
18 -- When we do this we don't have to escape / or ~ characters
19 -- (as ~1 and ~0 respectively) like we do in an escaped JSON
21 unless (P.unescape "/~1" == Right pntr2) (error "ohno!")
23 print (P.resolve pntr1 document)
24 print (P.resolve pntr2 document)
28 document = object [ "foo" .= [String "bar", String "baz"]
29 , "/" .= String "quux"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list