diff --git a/LICENSE.md b/LICENSE.md
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,5 +1,5 @@
 # Sydtest License
 
-Copyright (c) 2021 Tom Sydney Kerckhove
+Copyright (c) 2021-2022 Tom Sydney Kerckhove
 
 See the Sydtest License at https://github.com/NorfairKing/sydtest/blob/master/sydtest/LICENSE.md for the full license text.
diff --git a/src/Test/Syd/Aeson.hs b/src/Test/Syd/Aeson.hs
--- a/src/Test/Syd/Aeson.hs
+++ b/src/Test/Syd/Aeson.hs
@@ -1,5 +1,4 @@
 {-# LANGUAGE DataKinds #-}
-{-# LANGUAGE OverloadedStrings #-}
 
 module Test.Syd.Aeson
   ( -- * Golden tests
@@ -10,6 +9,8 @@
   )
 where
 
+import Control.DeepSeq
+import Control.Exception
 import Control.Monad
 import Data.Aeson as JSON
 import Data.Aeson.Encode.Pretty as JSON
@@ -35,9 +36,10 @@
             Right r -> pure r,
       goldenTestProduce = produceActualValue,
       goldenTestWrite = \v -> do
+        value <- evaluate $ force $ toJSON v
         p <- resolveFile' fp
         ensureDir (parent p)
-        SB.writeFile (fromAbsFile p) $ LB.toStrict $ JSON.encodePretty v,
+        SB.writeFile (fromAbsFile p) $ LB.toStrict $ JSON.encodePretty value,
       goldenTestCompare = \actual expected ->
         if actual == expected
           then Nothing
@@ -75,9 +77,10 @@
             Right r -> pure r,
       goldenTestProduce = produceActualValue,
       goldenTestWrite = \v -> do
+        value <- evaluate $ force $ toJSON v
         p <- resolveFile' fp
         ensureDir (parent p)
-        SB.writeFile (fromAbsFile p) $ LB.toStrict $ JSON.encodePretty v,
+        SB.writeFile (fromAbsFile p) $ LB.toStrict $ JSON.encodePretty value,
       goldenTestCompare = \actual expected ->
         if actual == expected
           then Nothing
diff --git a/sydtest-aeson.cabal b/sydtest-aeson.cabal
--- a/sydtest-aeson.cabal
+++ b/sydtest-aeson.cabal
@@ -1,23 +1,29 @@
 cabal-version: 1.12
 
--- This file has been generated from package.yaml by hpack version 0.34.4.
+-- This file has been generated from package.yaml by hpack version 0.34.7.
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: 2fe968a3a35d7b58c088bbfec8b58386928f7006a3424e650e765781459c162a
+-- hash: 146fca0f19cd3781f36f8b0224fcd12370fa9dc1506f8adbd22c3078a82992fd
 
 name:           sydtest-aeson
-version:        0.0.0.0
+version:        0.1.0.0
 synopsis:       An aeson companion library for sydtest
 category:       Testing
 homepage:       https://github.com/NorfairKing/sydtest#readme
 bug-reports:    https://github.com/NorfairKing/sydtest/issues
 author:         Tom Sydney Kerckhove
 maintainer:     syd@cs-syd.eu
-copyright:      Copyright (c) 2021 Tom Sydney Kerckhove
+copyright:      Copyright (c) 2021-2022 Tom Sydney Kerckhove
 license:        OtherLicense
 license-file:   LICENSE.md
 build-type:     Simple
+extra-source-files:
+    LICENSE.md
+    test_resources/example-value.json
+    test_resources/example.json
+    test_resources/pure-example-value.json
+    test_resources/pure-example.json
 
 source-repository head
   type: git
@@ -35,6 +41,7 @@
     , aeson-pretty
     , base >=4.7 && <5
     , bytestring
+    , deepseq
     , path
     , path-io
     , sydtest
@@ -55,6 +62,7 @@
   build-depends:
       aeson
     , base >=4.7 && <5
+    , directory
     , sydtest
     , sydtest-aeson
     , text
diff --git a/test/Test/Syd/AesonSpec.hs b/test/Test/Syd/AesonSpec.hs
--- a/test/Test/Syd/AesonSpec.hs
+++ b/test/Test/Syd/AesonSpec.hs
@@ -1,33 +1,70 @@
 {-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE ScopedTypeVariables #-}
 
 module Test.Syd.AesonSpec (spec) where
 
+import Control.Exception
+import Control.Monad
 import Data.Aeson as JSON
 import Data.Text (Text)
+import System.Directory (doesFileExist, removeFile)
 import Test.Syd
 import Test.Syd.Aeson
 
 spec :: Spec
 spec = do
-  describe "pureGoldenJSONFile" $
+  describe "pureGoldenJSONFile" $ do
     it "outputs this example the same as before" $
       pureGoldenJSONFile
         "test_resources/pure-example.json"
         $ JSON.object
           ["hello" .= ("world" :: Text), "a" .= (1 :: Int), "b" .= True]
+
+    it "does not write an empty file if encoding fails" $ do
+      let path = "test_resources/pure-example-exception.json"
+      let result = JSON.object ["undefined" .= (undefined :: Text)]
+      let goldenTest = pureGoldenJSONFile path result
+      -- Make sure there is nothing in the way
+      existsBefore <- doesFileExist path
+      when existsBefore $ removeFile path
+
+      -- Try to write, this will fail
+      goldenTestWrite goldenTest result `catch` (\(_ :: ErrorCall) -> pure ())
+
+      -- Make sure there is no file afterwards
+      exists <- doesFileExist path
+      exists `shouldBe` False
+
   describe "goldenJSONFile" $
     it "outputs this example the same as before" $
       goldenJSONFile
         "test_resources/example.json"
         $ pure $ JSON.object ["hello" .= ("world" :: Text), "a" .= (1 :: Int), "b" .= True]
-  describe "pureGoldenJSONValueFile" $
+
+  describe "pureGoldenJSONValueFile" $ do
     it "outputs this example the same as before" $
       pureGoldenJSONValueFile
-        "test_resources/pure-example.json"
+        "test_resources/pure-example-value.json"
         $ JSON.object
           ["hello" .= ("world" :: Text), "a" .= (1 :: Int), "b" .= True]
+
+    it "does not write an empty file if encoding fails" $ do
+      let path = "test_resources/pure-example-value-exception.json"
+      let result = JSON.object ["undefined" .= (undefined :: Text)]
+      let goldenTest = pureGoldenJSONValueFile path result
+      -- Make sure there is nothing in the way
+      existsBefore <- doesFileExist path
+      when existsBefore $ removeFile path
+
+      -- Try to write, this will fail
+      goldenTestWrite goldenTest result `catch` (\(_ :: ErrorCall) -> pure ())
+
+      -- Make sure there is no file afterwards
+      existsAfter <- doesFileExist path
+      existsAfter `shouldBe` False
+
   describe "goldenJSONValueFile" $
     it "outputs this example the same as before" $
       goldenJSONValueFile
-        "test_resources/example.json"
+        "test_resources/example-value.json"
         $ pure $ JSON.object ["hello" .= ("world" :: Text), "a" .= (1 :: Int), "b" .= True]
diff --git a/test_resources/example-value.json b/test_resources/example-value.json
new file mode 100644
--- /dev/null
+++ b/test_resources/example-value.json
@@ -0,0 +1,5 @@
+{
+    "a": 1,
+    "b": true,
+    "hello": "world"
+}
diff --git a/test_resources/example.json b/test_resources/example.json
new file mode 100644
--- /dev/null
+++ b/test_resources/example.json
@@ -0,0 +1,5 @@
+{
+    "hello": "world",
+    "a": 1,
+    "b": true
+}
diff --git a/test_resources/pure-example-value.json b/test_resources/pure-example-value.json
new file mode 100644
--- /dev/null
+++ b/test_resources/pure-example-value.json
@@ -0,0 +1,5 @@
+{
+    "a": 1,
+    "b": true,
+    "hello": "world"
+}
diff --git a/test_resources/pure-example.json b/test_resources/pure-example.json
new file mode 100644
--- /dev/null
+++ b/test_resources/pure-example.json
@@ -0,0 +1,5 @@
+{
+  "hello" : "world",
+  "a" : 1,
+  "b" : true
+}
