scala - Json4s custom serializer with unordered fields -
In the example given on json4s readymade, this match only works if the order of the field is "starting": 0, "End": 0}. The match does not work if the start and end fields are swapped. The case match below is such that the JSON field order does not make any difference? JField ("End is there anyway to write", Jont (E)) :: JField ("JField"):
Case JObject (JField) Code>
I have not used this library, so I'm sure if this is not the right approach CustomSerializer [Interval] spreads the class IntervalSerializer (format (I came up with this after watching a few minutes spent docs) => ({Case X: JObject = & Gt; x.obj.sortBy {Case (k, _) = & gt; k} {Match Matters JField ("End", jint (e)) :: jfield ("start", joint (s) :: neel => new interval (start = s.longValue (), end = e.long value ())} }, {Case x: interval = & gt; Jobfact (Jeffield ("start", jint (BigInt (x.startTime)) :: JField ("end", jint (BigInt (x.endTime)) :: zero )}))
To sort the characters according to the characters, and then create the interval class.
Comments
Post a Comment