transformations:constructjson
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
transformations:constructjson [2020/01/11 15:44] – dmitry | transformations:constructjson [2021/04/24 23:46] – craigt | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Construct | + | {{ transformations: |
+ | ======CONSTRUCT | ||
+ | Category: Transform / Advanced \\ | ||
+ | \\ | ||
+ | =====Description===== | ||
This action constructs a [[https:// | This action constructs a [[https:// | ||
* Object per row, array from objects | * Object per row, array from objects | ||
* Array per column | * Array per column | ||
- | A constructed JSON object is effectively a regular text value that is stored in a datagrid cell in EasyMorph. | + | A constructed JSON object is effectively a regular text value that is stored in a datagrid cell in EasyMorph.\\ |
- | ==== Mode " | + | \\ |
+ | =====Action settings===== | ||
+ | ==== Mode: " | ||
In this mode, each row of the source dataset is used to construct a flat JSON object in which every column value corresponds to one object property. For instance, the dataset below: | In this mode, each row of the source dataset is used to construct a flat JSON object in which every column value corresponds to one object property. For instance, the dataset below: | ||
Line 47: | Line 53: | ||
| | ||
</ | </ | ||
- | + | \\ | |
- | ==== Mode "Array per column" | + | ==== Mode: "Array per column" |
- | In this mode the source dataset is converted into a new dataset in which values of each column are rolled up into a JSON array. For instance the table from the example above would be converted into the following table: | + | In this mode, the source dataset is converted into a new dataset in which values of each column are rolled up into a JSON array. For instance, the table from the example above would be converted into the following table: |
^ ID ^ Name ^ | ^ ID ^ Name ^ | ||
| [1,2] | [Apple, | | [1,2] | [Apple, | ||
- | + | \\ \\ | |
- | ==== Data type conversion ==== | + | ===== Data type conversion |
EasyMorph data types are converted to JSON types as follows: | EasyMorph data types are converted to JSON types as follows: | ||
^ EasyMorph ^ Example ^ JSON ^ Example ^ | ^ EasyMorph ^ Example ^ JSON ^ Example ^ | ||
| Text | ABC | string | | Text | ABC | string | ||
- | | Number | + | | Number |
- | | Number (formatted as date) | 2020-Jan-10 | + | | Number (formatted as date) |
| Boolean | | Boolean | ||
| Empty | | Empty | ||
Line 68: | Line 74: | ||
Note that the action fails if the source dataset contains an error value. | Note that the action fails if the source dataset contains an error value. | ||
- | ==== Nesting JSON objects ==== | + | \\ |
- | EasyMorph detects if a text value already | + | ===== Nesting JSON objects |
+ | EasyMorph | ||
^ Track ^ Country | ^ Track ^ Country | ||
Line 89: | Line 96: | ||
} | } | ||
</ | </ | ||
- | Notice that Location is inserted as a JSON object, not as text. Field " | + | Notice that "Location" |
- | ==== See also ==== | + | \\ |
- | * [[https:// | + | ===== See also ===== |
* [[transformations: | * [[transformations: | ||
- | * [[syntax: | + | * [[syntax: |
+ | * [[https:// | ||
transformations/constructjson.txt · Last modified: 2022/10/02 20:16 by craigt