I have a JSON array returned from curl that looks like this:
[
{
"title": "Some Title",
"tags":"tagA tag-B tagC"
},
{
"title": "Some Title 2",
"tags":"tagA tagC"
},
...
]
I'd like to convert it to...
[
{
"title": "Some Title",
"tags":["tagA",
"tag-B",
"tagC"]
},
{
"title": "Some Title 2",
"tags":["tagA",
"tagC"]
},
...
]
So far I have:
(map(select(.tags!=null)) | map(.tags | split(" "))) as $tags | $tags
and that appears to give me something like:
[
[
"tagA",
"tag-B",
"tagC"
],
[
"tagA",
"tagC"
]
]
But I don't seem to be able to weave that back into an output that would give me .tags
as an array in the original objects with the original values...