Divooka Reference

JSON Files

4 nodes

On this page 4

Parse JSON

Function

A table from JSON text - a web API's response, or records typed into the node.

Signature
ParseJSON(JSON: Text) -> Table
Table ParseJSON(string json = "[{\"Name\": \"Alpha\", \"Value\": 1}, {\"Name\": \"Beta\", \"Value\": 2}]")

Parameters

nametypedefaultdescription
JSONText[{"Name": "Alpha", "Value": 1}, {"Name": "Bet...The JSON text.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
JSON Files
Package
Data Analytics

Read JSON

Function

A table from a JSON file: an array of objects is a row per object and a column per key; an object holding one such array, as an API response does, is read the same way; an object of equal-length arrays is a column per array. Nested objects become dotted column names.

Signature
ReadJSON(path: Text) -> Table
Table ReadJSON(string path)

Parameters

nametypedefaultdescription
pathText—The file.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
JSON Files
Package
Data Analytics

To JSON

Function

A table as JSON text: an array of records, one object per row.

Signature
ToJSON(table: Table, indented: Truth) -> Text
string ToJSON(Table table, bool indented = false)

Parameters

nametypedefaultdescription
tableTable—The table.
indentedTruthFalseWhether to lay the JSON out on several lines.

Returns

JSONText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
JSON Files
Package
Data Analytics

Write JSON

Function

Writes a table to a JSON file as an array of records, one object per row, and gives back the file's path.

Signature
WriteJSON(table: Table, path: Text, indented: Truth) -> Text
string WriteJSON(Table table, string path, bool indented = true)

Parameters

nametypedefaultdescription
tableTable—The table.
pathText—The file to write; its folder is created if need be.
indentedTruthTrueWhether to lay the JSON out on several lines.

Returns

PathText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
JSON Files
Package
Data Analytics