summaryrefslogtreecommitdiff
path: root/examples/pjson.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-05-27 17:33:58 -0400
committerjoe <joe@jerkface.net>2018-05-27 17:33:58 -0400
commitad52f14b981224137291281493b824b00cdd0497 (patch)
treeb60b97b8d0360ce2a22a79d7984553f5fccd3b03 /examples/pjson.hs
parent14d245ee6b5d3f1e51d5455c2c1b055087b99485 (diff)
Utility for pretty-printing json files: pjson
Diffstat (limited to 'examples/pjson.hs')
-rw-r--r--examples/pjson.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/pjson.hs b/examples/pjson.hs
new file mode 100644
index 00000000..a515febb
--- /dev/null
+++ b/examples/pjson.hs
@@ -0,0 +1,12 @@
1import Data.Aeson.Encode.Pretty
2import qualified Data.Aeson as J
3import Data.ByteString.Lazy.Char8 as B
4import Control.Monad
5import System.Environment
6
7main = do
8 args <- getArgs
9 forM_ args $ \fn -> do
10 v <- J.decode <$> B.readFile fn
11 let _ = v :: Maybe J.Value
12 mapM_ B.putStrLn (fmap encodePretty v)