Skip to content

Commit 9eb5f76

Browse files
committed
Add ToJSON instance
1 parent b9fb786 commit 9eb5f76

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/JSONPointer/Aeson.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module JSONPointer.Aeson where
44

5-
import Data.Aeson (FromJSON)
5+
import Data.Aeson (FromJSON, ToJSON)
66
import Data.Aeson qualified as Aeson
77
import Data.Aeson.Key qualified as KM
88
import Data.Aeson.KeyMap qualified as KM
@@ -35,3 +35,6 @@ instance FromJSON JSONPointer where
3535
case parse jsonPointerUriFragment t of
3636
Left err -> fail $ unpack err
3737
Right x -> pure x
38+
39+
instance ToJSON JSONPointer where
40+
toJSON p = Aeson.toJSON $ "#" <> show p

0 commit comments

Comments
 (0)