diff --git a/content/actions/learn-github-actions/expressions.md b/content/actions/learn-github-actions/expressions.md index 7409db10e10f..14fe4cc00b1e 100644 --- a/content/actions/learn-github-actions/expressions.md +++ b/content/actions/learn-github-actions/expressions.md @@ -366,4 +366,40 @@ For example, consider an array of objects named `fruits`. ] ``` -The filter `fruits.*.name` returns the array `[ "apple", "orange", "pear" ]` +The filter `fruits.*.name` returns the array `[ "apple", "orange", "pear" ]`. + +You may also use the `*` syntax on an object. For example, suppose you have an object named `vegetables`. + +```json + +{ + "scallions": + { + "colors": ["green", "white", "red"], + "ediblePortions": ["roots", "stalks"], + }, + "beets": + { + "colors": ["purple", "red", "gold", "white", "pink"], + "ediblePortions": ["roots", "stems", "leaves"], + }, + "artichokes": + { + "colors": ["green", "purple", "red", "black"], + "ediblePortions": ["hearts", "stems", "leaves"], + }, +} +``` + +The filter `vegetables.*.ediblePortions` could evaluate to: + +```json + +[ + ["roots", "stalks"], + ["hearts", "stems", "leaves"], + ["roots", "stems", "leaves"], +] +``` + +Since objects don't preserve order, the order of the output can not be guaranteed.