Added credit for merge by array example

This commit is contained in:
Mike Farah
2021-11-29 20:56:04 +11:00
parent 4c7c0b83aa
commit 418bd1a806
3 changed files with 12 additions and 0 deletions
+2
View File
@@ -33,6 +33,8 @@ var mergeArraysObjectKeysText = `There are two parts of the complex expression.
so that there are no duplicates. The second half converts that map back to an array.
To use this, you will need to update '.[]' to be the expression to your array (e.g. .my.array[]), and '.a' to be the key field of your array (e.g. '.name')
Thanks Kev from [stackoverflow](https://stackoverflow.com/a/70109529/1168223)
`
var mergeExpression = `((.[] | {.a: .}) as $item ireduce ({}; . * $item )) as $uniqueMap