I'm trying to make a transformation to every object in an array in my JSON
.
The JSON
looks something like this:
{
"foos": [
{
"urls": ["www.google.com", "www.google.com", "www.stackoverflow.com"]
},
{
"urls": ["www.facebook.com"]
},
...
]
}
I'm trying to remove duplicates from the urls
array.
I've tried using something like this:
(__ \\ 'urls).json.update(Reads.of[JsArray].map(scopes => JsArray(scopes.value.distinct)))
But keep getting an error about error.path.result.multiple
.
I can't seem to find a way to make the change to everything inside of a JSON array.
Also, I can't used case classes here because there are unknown fields on some of the data that I don't want to lose when converting to a case class.