-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combine values under the same key from a list of key-value pairs #3867
Comments
@engechas , I'm a bit unsure how we have the first example to begin with.
There should be only one |
You're right, the first one would not be possible. I've removed it |
The example given looks like what the ListToMap processor can handle with some changes, or a new processor that aggregates objects inside an array. I created another issue for "MapToList" processor that performs approximately the reversed operation of the ListToMap processor. |
If I can simplify the request a bit so that the objects in {
"mylist": [
{ "a": "b" },
{ "a": "c" },
{ "a": "y" },
]
} output: {
"a": ["b", "c", "y"]
} this could already help with the original user request (from an internal ticket) as well as #3963 and #3964. We can achieve this transformation with a small change to the existing
The processor config for the above example would look like this: processor:
- list_to_map:
value_key: "a"
source: "mylist" |
@oeyh , The original ask in this issue is to get the key from the inner map and then combine the values together. I do think this can be achieved by using the existing
|
@dlvenable My only concern with the above approach is that the behavior for {
"a": [{ "a": "b" }, { "a": "c" }]
"x": [{ "x": "y" }]
} But we can probably add another boolean flag - list_to_map:
source: mylist
use_source_key: true
extract_value: true |
Is your feature request related to a problem? Please describe.
As a user, I would like to have the ability to transform a map to a list, or flatten a list of maps to a list.
Example input:
Example output:
Describe the solution you'd like
A new processor created to implement the above described functionality
The text was updated successfully, but these errors were encountered: