JSON.PROCESS
Premium
Traverses given JSON object and processes each cell in specified cell-range. Before the cell-range is processed the current JSON value is written to defined value cell, whereas the corresponding key is returned from the function itself. A nested JSON can be completely traversed by setting the optional recursive parameter to TRUE. To immediately stop the JSON traversal use BREAK() in processed cell-range.
Syntax
=JSON.PROCESS(JSON, ValueCell, CellRange, [Recursive])
Arguments
| Name | Type | Description |
|---|---|---|
| JSON | JSON | A JSON object to process. |
| ValueCell | Cell | Cell-reference to write current JSON value to. |
| CellRange | Range | Cell-range to process for each JSON value. |
| Recursive (optional) | Boolean | Specify TRUE to completely traverse a nested JSON object. Default value: FALSE |
Return
| Type | Description |
|---|---|
| String or Error | Currently processed JSON key or an error value. |
Examples
Traverse simple JSON and process specified cell-range:
| A | |
|---|---|
| 1 | {"name": "foo", "age": 42 } |
| 2 | =CONCAT(A2, A4, "-") |
| 3 | =CONCAT(A3, B3, "-") |
| Formula | Result | Comment |
|---|---|---|
| age | Processes given cell-range for each JSON key-value pair. When finished A2 contains all the keys (-name-age-) and A3 all the corresponding values (-foo-42-) |