@@ -5,6 +5,11 @@ import org.json4s.ext.{EnumNameSerializer, UUIDSerializer}
5
5
import java .time ._
6
6
import java .util .Base64
7
7
import scala .reflect .ClassTag
8
+ import com .fasterxml .jackson .core ._
9
+ import com .fasterxml .jackson .core .util ._
10
+ import com .fasterxml .jackson .core .json .JsonWriteFeature
11
+ import com .fasterxml .jackson .databind ._
12
+ import org .json4s .jackson .Json4sScalaModule
8
13
9
14
object CommonJson4sFormats {
10
15
implicit val commonFormats : Formats = DefaultFormats +
@@ -47,9 +52,9 @@ object JavaTimeJson4sFormats {
47
52
object GeoJsonJson4sFormats {
48
53
implicit val geoJsonFormats : Formats = new DefaultFormats {
49
54
override val typeHints : TypeHints = new SimpleTypeHints (List (
50
- classOf [GeoJSON .Point ], classOf [GeoJSON .MultiPoint ], classOf [GeoJSON .LineString ],
51
- classOf [GeoJSON .MultiLineString ], classOf [GeoJSON .Polygon ], classOf [GeoJSON .MultiPolygon ],
52
- classOf [GeoJSON .GeometryCollection ], classOf [GeoJSON .Feature ], classOf [GeoJSON .FeatureCollection ]))
55
+ classOf [GeoJSON .Point ], classOf [GeoJSON .MultiPoint ], classOf [GeoJSON .LineString ],
56
+ classOf [GeoJSON .MultiLineString ], classOf [GeoJSON .Polygon ], classOf [GeoJSON .MultiPolygon ],
57
+ classOf [GeoJSON .GeometryCollection ], classOf [GeoJSON .Feature ], classOf [GeoJSON .FeatureCollection ]))
53
58
} +
54
59
new CustomSerializer [(Double , Double )](_ => ({
55
60
case JArray (JDouble (x) :: JDouble (y) :: Nil ) => new Tuple2 [Double , Double ](x, y)
@@ -92,12 +97,6 @@ class SimpleTypeHints(override val hints: List[Class[_]],
92
97
}
93
98
94
99
object Json4sJacksonMappers {
95
- import com .fasterxml .jackson .core ._
96
- import com .fasterxml .jackson .core .util ._
97
- import com .fasterxml .jackson .core .json .JsonWriteFeature
98
- import com .fasterxml .jackson .databind ._
99
- import org .json4s .jackson .Json4sScalaModule
100
-
101
100
private [this ] def mapper (indentOutput : Boolean = false , escapeNonAscii : Boolean = false ,
102
101
useBigNumber : Boolean = false ): ObjectMapper = {
103
102
val jsonFactory = new JsonFactoryBuilder ()
@@ -119,8 +118,8 @@ object Json4sJacksonMappers {
119
118
}
120
119
121
120
val mapper : ObjectMapper = mapper()
121
+ val jValueType : JavaType = mapper.constructType(classOf [JValue ])
122
122
val bigNumberMapper : ObjectMapper = mapper(useBigNumber = true )
123
123
val prettyPrintMapper : ObjectMapper = mapper(indentOutput = true )
124
124
val escapeNonAsciiMapper : ObjectMapper = mapper(escapeNonAscii = true )
125
- val jValueType : JavaType = mapper.constructType(classOf [JValue ])
126
125
}
0 commit comments