diff options
author | joe <joe@jerkface.net> | 2018-05-27 17:33:58 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2018-05-27 17:33:58 -0400 |
commit | ad52f14b981224137291281493b824b00cdd0497 (patch) | |
tree | b60b97b8d0360ce2a22a79d7984553f5fccd3b03 /examples/pjson.hs | |
parent | 14d245ee6b5d3f1e51d5455c2c1b055087b99485 (diff) |
Utility for pretty-printing json files: pjson
Diffstat (limited to 'examples/pjson.hs')
-rw-r--r-- | examples/pjson.hs | 12 |
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 @@ | |||
1 | import Data.Aeson.Encode.Pretty | ||
2 | import qualified Data.Aeson as J | ||
3 | import Data.ByteString.Lazy.Char8 as B | ||
4 | import Control.Monad | ||
5 | import System.Environment | ||
6 | |||
7 | main = 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) | ||