json_join
Joins values extracted from a list of objects using one or more JSON paths, concatenating them into a single string with a separator. This is a convenience function that combines JSON path extraction and string joining in one step.
Syntax
json_join(separator, source_list, path1, path2, ...)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| separator | string | Yes | The separator string to insert between extracted values. |
| source_list | list | Yes | The list of objects to extract values from. |
| path1, path2, ... | string | Yes (at least one) | One or more JSON path expressions to extract from each object. |
Returns
Type: string
A single string with all extracted values joined by the separator. Values are extracted in order: for each item in the list, each path is resolved in sequence.
Examples
Join names from a list of objects:
json_join(", ", [users], "name")
If users is [{"name": "Alice"}, {"name": "Bob"}], the result is "Alice, Bob".
Extract multiple fields per object:
json_join(" | ", [books], "title", "author")
If books is [{"title": "Book 1", "author": "Author A"}, {"title": "Book 2", "author": "Author B"}], the result is "Book 1 | Author A | Book 2 | Author B".
Build a summary from nested data:
json_join("; ", [incidents], "number", "short_description")
If incidents is [{"number": "INC001", "short_description": "Login failure"}, {"number": "INC002", "short_description": "Timeout"}], the result is "INC001; Login failure; INC002; Timeout".
Notes
- The function iterates over each item in the source list and, for each item, extracts the value at each provided path. All extracted values are then joined with the separator.
- Values are converted to strings before joining.
- Uses JSON path resolution internally, so nested paths like
"address.city"are supported.
Comments
0 comments
Please sign in to leave a comment.