diff --git a/Main.hs b/Main.hs
--- a/Main.hs
+++ b/Main.hs
@@ -5,6 +5,10 @@
 import Control.Applicative ( (<|>) )
 import Data.List
 import Data.Maybe
+import Data.ByteString.UTF8 as BS8
+import Data.ByteString.Lazy.UTF8 as LBS8
+import Data.Aeson as JSON
+import Data.Yaml as YAML
 import Prelude hiding (getContents)
 import System.FilePath
 import System.IO (withFile, IOMode (ReadMode, WriteMode), hPutStr, hPutStrLn, stdout)
@@ -47,17 +51,23 @@
         then putStr dst
         else withFile dstFilename WriteMode $ flip hPutStr dst
 
+roundTripYaml :: Monad m => String -> m String
+roundTripYaml s =
+    maybe (fail "Invalid YAML") (return . LBS8.toString . JSON.encode) .
+        (YAML.decode :: BS8.ByteString -> Maybe JSON.Value) .
+        BS8.fromString $ s
+
 process :: CommandArgs -> String -> FilePath -> String -> IO String
 process cmdargs templateName filename src = do
     let reader = getReader cmdargs filename filename
         write = getWriter cmdargs templateName
-        rundata = caRunData cmdargs
-        pre = "{%with " ++ rundata ++ " %}\n"
+    rundata <- roundTripYaml $ caRunData cmdargs
+    let pre = "{%with " ++ rundata ++ " %}\n"
         post = "{%endwith%}\n"
         src' = if null rundata
                     then src
                     else pre ++ src ++ post
-        optimizationLevel = caOptimizationLevel cmdargs 
+        optimizationLevel = caOptimizationLevel cmdargs
         opt = case optimizationLevel of
                 0 -> id
                 otherwise -> optimize
@@ -92,7 +102,7 @@
             <|> inputLanguageFromFilename filePath
             <|> Just Paco
     in effectiveInputLanguage
-    
+
 inputLanguageFromFilename :: FilePath -> Maybe InputLanguage
 inputLanguageFromFilename fn =
     case takeExtension fn of
diff --git a/hpaco.cabal b/hpaco.cabal
--- a/hpaco.cabal
+++ b/hpaco.cabal
@@ -1,5 +1,5 @@
 name:                hpaco
-version:             0.25.2.0
+version:             0.26.0.0
 synopsis:            Modular template compiler
 description:         CLI front-end to the hpaco-lib library. Compiles Paco
                      template source code to JavaScript or PHP, or interprets
@@ -9,18 +9,21 @@
 license-file:        LICENSE
 author:              Tobias Dammers
 maintainer:          tdammers@gmail.com
--- copyright:           
+-- copyright:
 category:            Development
 build-type:          Simple
 cabal-version:       >=1.8
 
 executable hpaco
   main-is:             Main.hs
-  -- other-modules:       
+  -- other-modules:
   build-depends:       base == 4.*
                ,       filepath >= 1.1 && < 1.4
                ,       cmdargs >= 0.9 && < 0.10
-               , hpaco-lib == 0.25.2.0
-               ,       strict == 0.3.*
+               , hpaco-lib == 0.26.0.0
+               ,       strict >= 0.3
+               ,       yaml >= 0.6
+               ,       aeson >= 0.6
+               ,       utf8-string >= 0.3
                -- ,       split >= 0.1 && < 0.2
                -- ,       safe >= 0.3.3 && < 0.4
