Reputation: 9103
I have two JsArray
s representing these two json feeds:
[{
"value1":"foo",
"value2":"bar"
}, {...}]
[{
"value3":"foo2",
"value4":"bar2"
}, {...}]
How can I merge only the first element of each one to get:
{
"value1":"foo",
"value2":"bar",
"value3":"foo2",
"value4":"bar2"
}
using spray.json
?
Upvotes: 1
Views: 737
Reputation: 1
(array1.convertTo[Map[String,JsValue]] ++ array2.convertTo[Map[String,JsValue]]).toJson.asJsArray
Assuming array1 and array2 are JsArray
Upvotes: 0