diff options
-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) | ||