@@ -2,7 +2,6 @@ package io.circe
2
2
3
3
import com .github .plokhotnyuk .jsoniter_scala .core ._
4
4
import io .circe .Json ._
5
- import java .nio .charset .StandardCharsets
6
5
import java .util
7
6
import scala .collection .immutable .VectorBuilder
8
7
@@ -40,7 +39,7 @@ object JsoniterScalaCodec {
40
39
case f : JsonFloat => out.writeVal(f.value)
41
40
case d : JsonDouble => out.writeVal(d.value)
42
41
case bd : JsonBigDecimal => out.writeVal(bd.value)
43
- case _ => out.writeRawVal (x.toString.getBytes( StandardCharsets . UTF_8 ) )
42
+ case _ => out.writeNonEscapedAsciiVal (x.toString)
44
43
}
45
44
46
45
val jsCompatibleNumberSerializer : (JsonWriter , JsonNumber ) => Unit = (out : JsonWriter , x : JsonNumber ) => x match {
@@ -58,13 +57,13 @@ object JsoniterScalaCodec {
58
57
else out.writeValAsString(v)
59
58
case _ => x.toBigDecimal match {
60
59
case Some (bd) =>
61
- val u = bd.underlying
60
+ val u = bd.bigDecimal
62
61
val bl = u.unscaledValue.bitLength
63
62
val s = u.scale
64
63
if (bl <= 52 && s >= - 256 && s <= 256 ) out.writeVal(u)
65
64
else out.writeValAsString(u)
66
65
case _ =>
67
- out.writeVal (x.toString)
66
+ out.writeNonEscapedAsciiVal (x.toString)
68
67
}
69
68
}
70
69
@@ -75,7 +74,7 @@ object JsoniterScalaCodec {
75
74
* @param len the length of the byte array
76
75
* @return a JSON string
77
76
*/
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))
79
78
80
79
/**
81
80
* Extracts a `String` value from a JSON cursor.
0 commit comments