           (do (.append buffer (char c))
               (recur (.read stream)))))))
 
+(defn- read-json-number [^PushbackReader stream]
+  (let [buffer (StringBuilder.)
+        floating-point?
+          (loop [float? false]
+            (let [c (.read stream)]
+              (codepoint-case c
+                (\- \+ \0 \1 \2 \3 \4 \5 \6 \7 \8 \9)
+                (do (.append buffer (char c))
+                    (recur float?))
+                (\e \E \.)
+                (do (.append buffer (char c))
+                    (recur true))
+                (do (.unread stream c)
+                    float?))))]
+    (if floating-point?
+      (Double/valueOf (str buffer))
+      (Long/valueOf (str buffer)))))
+
 (defn- read-json-reader
   ([^PushbackReader stream keywordize? eof-error? eof-value]
      (loop [c (.read stream)]

	 (codepoint-case c
           :whitespace (recur (.read stream))

           ;; Read numbers with Clojure reader
           (\- \0 \1 \2 \3 \4 \5 \6 \7 \8 \9)
           (do (.unread stream c)
               (read stream true nil))

           ;; Read strings
           \" (read-json-quoted-string stream)

  (:use [clojure.pprint :only (write formatter-out)])
  (:import (java.io PrintWriter PushbackReader StringWriter
                    StringReader Reader EOFException)))

(set! *warn-on-reflection* true)

;;; JSON READER

