Add monger.json that extends clojure.data.json.Write-JSON protocol to handle org.bson.types.ObjectId

This commit is contained in:
Michael S. Klishin 2011-09-04 00:49:47 +04:00
parent 4700213bd5
commit c29748e46c

8
src/monger/json.clj Normal file
View 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?)))