seratch on v3.6.4
seratch on 3.6
version 3.6.4 Start 3.6.5 dev (compare)
seratch on 3.6
Reduced OrElse objects allocati… Merge branch '3.6' into pr-580-… Merge branch '3.6' into pr-580-… and 1 more (compare)
seratch on 3.6
fix Type alias for parameterize… Merge branch '3.6' into pr-577-… Merge pull request #581 from se… (compare)
seratch on 3.6
Add 3.6.3 to previous versions … (compare)
seratch on master
Reduced OrElse objects allocati… (compare)
class DoubleColonSerializer[A](formats: Formats = DefaultFormats)(implicit m: Manifest[A]) extends CustomSerializer[::[A]]({ _ =>
implicit val f = formats
({
case jArr: JArray =>
val l = jArr.extract[List[A]]
::(l.head, l.tail)
},{
case nel: ::[A] =>
JArray(nel.map(Extraction.decompose))
})
})
implicit val formats =
DefaultFormats +
new DoubleColonSerializer[Any]
read[LearningPath](jsonString)
in my constructor to deserialize and the LearningPath
type is defined like this: http://scalikejdbc.org/documentation/one-to-x.htmlorg.json4s.JValue = JObject(List((@context,JArray(List(JString(https://raw.githx,JString(https://api.weather.gov/ontology#)), (geo,JString(http://www.opengis.net/ontapi.weather.gov/ontology#))))))), (type,JString(Feature)), (geometry,JObject(List((typ, (coordinates,JArray(List(JDouble(-123.0102602), JDouble(48.5993352)))))), JObject(Li0288715), JDouble(48.6073768))), JArray(List(JDouble(-123.0224183), JDouble(48.5870264...
.values
and it looks likeMap(@context -> List(https://raw.githubusercontent.com/geojson/geojson-ld/master/contexts/geojson-base.jsonld, Map(wx -> https://api.weather.gov/ontology#, geo -> http://www.opengis.net/ont/geosparql#, unit -> http://codes.wmo.int/common/unit/, @vocab -> https://api.weather.gov/ontology#)), type -> Feature, geometry -> Map(type -> GeometryCollection, geometries -> List(Map(type -> Point, coordinates -> List(-123.0102602, 48.5993352)), Map(type -> Polygon, coordinates -> List(List(List(-123.0288715, 48.6073768), List(-123.0224183, 48.5870264), List(-122.9916522, 48.5912913), List(-122.9980987, 48.6116418), List(-123.0288715, 48.6073768)))))), properties -> HashMap(periods -> List(HashMap(number -> 1, shortForecast -> Mostly Cloudy then Chance Light Rain, startTime ...
scala> parsed.values.
!= + == ensuring formatted hashCode toString
## -> asInstanceOf equals getClass isInstanceOf →
{
"stuff": [
{
"a": null,
"b": "wombat",
"c": [],
"d": 7,
"uids": {
"id": "0cd1a7f8-cee0-4f54-9c6b-534c123f2ec6"
}
},
{
"file_links": [],
"name": "Abstract Butter",
"notes": "Shortening for making rich, buttery baked goods",
"process": {
"id": "b8f748cf-c313-4f2c-8e38-84d7701f9609",
"scope": "id",
"type": "link_by_uid"
}
}
]
}
by a lot of work I meant lot of I/O
I am answering my question - to do what I needed (transform a product type to JObject directly -> http://json4s.org/ use decompose)
Hi folks. How do I filter off objects from a json array?
For example:
{
"name": "John"
},
{
"name": "Joseph"
},
{
"name": "Peter"
}
]
I'd like to filter off objects with names which are not starting with Jo
:
{
"name": "John"
},
{
"name": "Joseph"
}
]
The result might be a String or JValue with json array inside.
Thanks.
Exception in thread "main" org.json4s.package$MappingException: Do not know how to serialize key of type class my.custom.Type. Consider implementing a CustomKeySerializer.
, like a low-priority custom serializer that turns the error into a String in the emitted JSON or something?
class MyJInstantSerializer
extends CustomSerializer[Instant](format =>
(
{
// case JInt(d) => Instant.ofEpochMilli(d.toLong)
case JString(d) => Instant.parse(d)
case JNull => null
}, {
// case d: Instant => JInt(d.toEpochMilli)
case d: Instant => JString(d.toString())
}
)
)