@@ -5,6 +5,11 @@ import org.json4s.ext.{EnumNameSerializer, UUIDSerializer}
55import java .time ._
66import java .util .Base64
77import 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
813
914object CommonJson4sFormats {
1015 implicit val commonFormats : Formats = DefaultFormats +
@@ -47,9 +52,9 @@ object JavaTimeJson4sFormats {
4752object GeoJsonJson4sFormats {
4853 implicit val geoJsonFormats : Formats = new DefaultFormats {
4954 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 ]))
5358 } +
5459 new CustomSerializer [(Double , Double )](_ => ({
5560 case JArray (JDouble (x) :: JDouble (y) :: Nil ) => new Tuple2 [Double , Double ](x, y)
@@ -92,12 +97,6 @@ class SimpleTypeHints(override val hints: List[Class[_]],
9297}
9398
9499object 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-
101100 private [this ] def mapper (indentOutput : Boolean = false , escapeNonAscii : Boolean = false ,
102101 useBigNumber : Boolean = false ): ObjectMapper = {
103102 val jsonFactory = new JsonFactoryBuilder ()
@@ -119,8 +118,8 @@ object Json4sJacksonMappers {
119118 }
120119
121120 val mapper : ObjectMapper = mapper()
121+ val jValueType : JavaType = mapper.constructType(classOf [JValue ])
122122 val bigNumberMapper : ObjectMapper = mapper(useBigNumber = true )
123123 val prettyPrintMapper : ObjectMapper = mapper(indentOutput = true )
124124 val escapeNonAsciiMapper : ObjectMapper = mapper(escapeNonAscii = true )
125- val jValueType : JavaType = mapper.constructType(classOf [JValue ])
126125}
0 commit comments