Skip to main content
Version: Streamsheets 3.0

JSON.TO.RANGE

Writes the content of given json to a specified cell range. It is recommended, but not a mandatory, to encode passed json with either array, dictionary, range or the json function itself. For better results the encoding type and direction parameters can be specified. Please refer to JSON.VALUE if only a single json value should be extracted.

Syntax

=JSON.TO.RANGE(JSON, TargetRange, [Type], [Direction])

Arguments

NameTypeDescription
JSONJSONA json object which data will be written to specified target range.
TargetRangeRangeA cell range to write json data to. If the range size covers only one cell, it will be automatically increased to match content of given json.
Type (optional)FunctionTypeA text which describes the function used for encoding. Should be one of ARRAY, DICTIONARY, JSON, JSONROOT or RANGE. Note: the difference beteween JSON and JSONROOT is that JSON traverses the complete json while JSONROOT stops after first level.

Options:
"ARRAY"
"DICTIONARY"
"JSON"
"JSONROOT"
"RANGE"

Default value: "JSON"
Direction (optional)Specify TRUE to align keys vertically for type ARRAY, JSON or JSONROOT and horizontally for type DICTIONARY or RANGE. Note that the result might depends on the direction used to encode given json.

Default value: TRUE

Return

TypeDescription
Booelan or ErrorTRUE, if no error occurred, otherwise an error value.

Examples

Below examples assumes following SourceRange:

AB
1v123
1v242
FormulaResultComment
=JSON.TO.RANGE(ARRAY(A1:B2), A5:B6, ”ARRAY”)
Results in:
A5=”v1”, B5=”23”
A6=”v1”, B6=”42”
=JSON.TO.RANGE(DICTIONARY(A1:B2), A5:B6, ”DICTIONARY”,FALSE)
Results in:
A5=”v1”, B5=”23”
A6=”v1”, B6=”42”
=JSON.TO.RANGE(JSON(A1:B2), A5:B6, FALSE)
Results in:
A5=”v1”, B5=”v2” A6=”23”,
B6=”42”
=JSON.TO.RANGE(RANGE(A1:B2), A5:B6, ”RANGE”, FALSE)
Results in:
A5=”v1”, B5=”v2”
A6=”23”, B6=”42”