I have a list of Json Objects in this form:
[{'a': JsonObj()}, {'b':JsonObj()}, .... ]
How do I flatten the list into this form:
{'a': JsonObj(), 'b': JsonObj(), ...}
Note each field has a nested JsonObj as its value. I do not want to flatten those json objects.
I thought of appending it into a empty JsonObj but doesn't work.
val rStreetsJsonObj: JsObject = Json.obj()
for (routeS <- jsonList) {
rStreetsJsonObj.+(routeS) // Gives error: expected arguments should be of the form (String, jsValue) not JsObject
}
Any ideas?
list.foldLeft(Json.obj())(_ deepMerge _)