I have a variable descriptions
that is an Option[JsonArray]
(JsonArray
results from calling getJsonArray
on a JsonObject
). descriptions
is a list of objects that I'm getting back as a response from a server. Each object has a structure like so:
{age: String,
number: Long,
link: String}
I'd like to loop through this JsonArray
and edit the link
field to a certain value that is returned from a function. I don't even need to edit it in place and can take a new array of objects. In JS, it might be as simple as descriptions.map(d => ({...d, link: someValue}))
but I'm not sure how I need to transform the JsonArray
to get this working in Scala. Any help is appreciated!