From c29748e46c27bf7b2f95dad87ae43c348226ab20 Mon Sep 17 00:00:00 2001 From: "Michael S. Klishin" Date: Sun, 4 Sep 2011 00:49:47 +0400 Subject: [PATCH] Add monger.json that extends clojure.data.json.Write-JSON protocol to handle org.bson.types.ObjectId --- src/monger/json.clj | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/monger/json.clj diff --git a/src/monger/json.clj b/src/monger/json.clj new file mode 100644 index 0000000..780d681 --- /dev/null +++ b/src/monger/json.clj @@ -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?)))