-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Description
Hi, i would like to transform the following source json:
{
"friends": [
{"name": "Chris", "url": "https://localhost/feature/logs?IncludeDetails=true&StartDate=2023-01-14&api_key=58fd29c2-af2d-4d60-80b1-e2f6fbba621d&format=json"}
]
}So that i can map it to {apiKey: value} where the value is derived from the api_key query string. I tried to use something like this but to no avail.
.friends
| map({
name: .name,
apiKey: regex(.url, "[?&]api_key=([^&]+)")
})The output is:
[{"name": "Chris", "apiKey": true}]which i understand it makes sense because the regex function only asserts whether the text provided matches the regex or not. However, what i need here is to extract the api_key and map it to a new value. Is this doable?
Metadata
Metadata
Assignees
Labels
No labels