I having big toruble with Argonaut. I am needing to collect all elements in JSON array. For example, I having this data in JSON.
val data = """{"id": 1, "items": [{"name": "foo","price": 10},{"name": "bar","price": 20}]}"""
Then I am needing to collect all name
values into List. So I am getting this
List("foo", "bar")
This is meaning that I am needing to traverse array so I am choosing Argonaut library to do this. But is very difficult to know how API is working in Argonaut. So far I have this,
val data = """{"id": 1, "items": [{"name": "foo","price": 10},{"name": "bar","price": 20}]}""".parseOption
data flatMap (k =>
+k --\ "items" flatMap (_.downArray) map (- _)
)
But I am not sure how to get values. Please I am needing advices here.