@@ -2,7 +2,6 @@ package io.circe
22
33import com .github .plokhotnyuk .jsoniter_scala .core ._
44import io .circe .Json ._
5- import java .nio .charset .StandardCharsets
65import java .util
76import scala .collection .immutable .VectorBuilder
87
@@ -40,7 +39,7 @@ object JsoniterScalaCodec {
4039 case f : JsonFloat => out.writeVal(f.value)
4140 case d : JsonDouble => out.writeVal(d.value)
4241 case bd : JsonBigDecimal => out.writeVal(bd.value)
43- case _ => out.writeRawVal (x.toString.getBytes( StandardCharsets . UTF_8 ) )
42+ case _ => out.writeNonEscapedAsciiVal (x.toString)
4443 }
4544
4645 val jsCompatibleNumberSerializer : (JsonWriter , JsonNumber ) => Unit = (out : JsonWriter , x : JsonNumber ) => x match {
@@ -58,13 +57,13 @@ object JsoniterScalaCodec {
5857 else out.writeValAsString(v)
5958 case _ => x.toBigDecimal match {
6059 case Some (bd) =>
61- val u = bd.underlying
60+ val u = bd.bigDecimal
6261 val bl = u.unscaledValue.bitLength
6362 val s = u.scale
6463 if (bl <= 52 && s >= - 256 && s <= 256 ) out.writeVal(u)
6564 else out.writeValAsString(u)
6665 case _ =>
67- out.writeVal (x.toString)
66+ out.writeNonEscapedAsciiVal (x.toString)
6867 }
6968 }
7069
@@ -75,7 +74,7 @@ object JsoniterScalaCodec {
7574 * @param len the length of the byte array
7675 * @return a JSON string
7776 */
78- def asciiStringToJString [ A ] (buf : Array [Byte ], len : Int ): Json = new JString (StringUtil .toString(buf, len))
77+ def asciiStringToJString (buf : Array [Byte ], len : Int ): Json = new JString (StringUtil .toString(buf, len))
7978
8079 /**
8180 * Extracts a `String` value from a JSON cursor.
0 commit comments