Add monger.json that extends clojure.data.json.Write-JSON protocol to handle org.bson.types.ObjectId
This commit is contained in:
parent
4700213bd5
commit
c29748e46c
1 changed files with 8 additions and 0 deletions
8
src/monger/json.clj
Normal file
8
src/monger/json.clj
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
(ns monger.json
|
||||
(:import (org.bson.types ObjectId))
|
||||
(:require [clojure.data.json :as json]))
|
||||
|
||||
(extend-protocol json/Write-JSON
|
||||
ObjectId
|
||||
(write-json [^ObjectId object out escape-unicode?]
|
||||
(json/write-json (.toString object) out escape-unicode?)))
|
||||
Loading…
Reference in a new issue