   ;; opening bracket.
   (loop [i (.read stream), result (transient [])]
     (when (neg? i) (throw (EOFException. "JSON error (end-of-file inside array)")))
-    (let [c (char i)]
+    (let [c i]
       (cond
        (Character/isWhitespace c) (recur (.read stream) result)
-       (= c \,) (recur (.read stream) result)
-       (= c \]) (persistent! result)
-       :else (do (.unread stream (int c))
+       (= c (codepoint \,)) (recur (.read stream) result)
+       (= c (codepoint \])) (persistent! result)
+       :else (do (.unread stream i)
                  (let [element (read-json-reader stream keywordize? true nil)]
                    (recur (.read stream) (conj! result element))))))))
 


;;; JSON READER

(declare read-json-reader)

(defn- read-json-array [^PushbackReader stream keywordize?]

(defn- read-json-escaped-character [^PushbackReader stream]
  ;; Expects to be called with the head of the stream AFTER the
  ;; initial backslash.
  (let [c (.read stream)]
    (cond
     (#{(codepoint \") (codepoint \\) (codepoint \/)} c) (char c)
     (= c (codepoint \b)) \backspace
     (= c (codepoint \f)) \formfeed
     (= c (codepoint \n)) \newline
     (= c (codepoint \r)) \return
     (= c (codepoint \t)) \tab
     (= c (codepoint \u)) (read-json-hex-character stream))))

(defn- read-json-quoted-string [^PushbackReader stream]
  ;; Expects to be called with the head of the stream AFTER the
