diff --git a/Main.hs b/Main.hs
--- a/Main.hs
+++ b/Main.hs
@@ -102,23 +102,27 @@
 module Main (initializedaemon, diff, main) where
 
 import System.Environment
-import Puppet.Init
-import Puppet.Daemon
-import Puppet.Printers
-import Puppet.Interpreter.Types
-import Facter
 import Data.List
 import System.IO
 import qualified Data.Map as Map
 import Data.Algorithm.Diff
 import qualified System.Log.Logger as LOG
-import Puppet.DSL.Loader
 import System.Exit
 import Control.Monad
 import Control.Monad.Error (runErrorT)
-import Puppet.DSL.Printer
 import Data.Char (toLower)
+import qualified Data.ByteString.Lazy.Char8 as BSL
+
+import Facter
+
+import Puppet.Init
+import Puppet.Daemon
+import Puppet.Printers
+import Puppet.Interpreter.Types
 import Puppet.Testing
+import Puppet.DSL.Printer
+import Puppet.DSL.Loader
+import Puppet.JsonCatalog
 
 usage = error "Usage: puppetresource puppetdir nodename [filename]"
 
@@ -133,7 +137,7 @@
 hackish as it will generate facts from the local computer !
 -}
 
-initializedaemonWithPuppet :: Maybe String -> String -> IO ([Char] -> IO FinalCatalog)
+initializedaemonWithPuppet :: Maybe String -> String -> IO ([Char] -> IO (FinalCatalog, EdgeMap, FinalCatalog))
 initializedaemonWithPuppet purl puppetdir = do
     LOG.updateGlobalLogger "Puppet.Daemon" (LOG.setLevel LOG.WARNING)
     prefs <- genPrefs puppetdir
@@ -142,11 +146,12 @@
         o <- allFacts nodename >>= queryfunc nodename
         case o of
             Left err -> error err
-            Right (c,m,_) -> return $ foldl' addRequire c (Map.toList m)
+            Right (c,m,e) -> do
+                return $ (foldl' addRequire c (Map.toList m), m, e)
         )
 
 {-| A helper for when you don't want to use PuppetDB -}
-initializedaemon :: String -> IO ([Char] -> IO FinalCatalog)
+initializedaemon :: String -> IO ([Char] -> IO (FinalCatalog, EdgeMap, FinalCatalog))
 initializedaemon = initializedaemonWithPuppet Nothing
 
 showparam (k,v) = k ++ " => " ++ show v
@@ -282,11 +287,15 @@
                 Nothing    -> printContent resname cat
 
     queryfunc <- initializedaemonWithPuppet puppeturl puppetdir
-    x <- queryfunc nodename
+    (x,m,e) <- queryfunc nodename
     tests <- testCatalog puppetdir x []
     case tests of
         Right _ -> return ()
         Left rr -> error rr
     if length rargs == 3
-        then handlePrintResource (rargs !! 2) x
+        then if (rargs !! 2) == "JSON"
+                 then do
+                     let json = catalog2JSon nodename 1 x e m
+                     BSL.putStrLn json
+                 else handlePrintResource (rargs !! 2) x
         else putStrLn $ showFCatalog x
diff --git a/puppetresources.cabal b/puppetresources.cabal
--- a/puppetresources.cabal
+++ b/puppetresources.cabal
@@ -2,7 +2,7 @@
 -- documentation, see http://haskell.org/cabal/users-guide/
 
 name:                puppetresources
-version:             0.4.0
+version:             0.4.1
 synopsis:            A program that displays the puppet resources associated to a node given .pp files.
 -- description:         
 license:             GPL-3
@@ -25,9 +25,10 @@
   ghc-options:         -rtsopts
   -- other-modules:       
   build-depends:       base >=3 && <5,
-                       language-puppet >= 0.3.0.0,
+                       language-puppet >= 0.3.1.0,
                        hsfacter        >= 0.2.0.0,
                        containers,
                        hslogger,
                        Diff,
-                       mtl
+                       mtl,
+                       bytestring
