User Tools

Site Tools


transformations:constructjson

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
transformations:constructjson [2020/01/11 20:44]
dmitry
transformations:constructjson [2020/01/11 20:55] (current)
dmitry [Nesting JSON objects]
Line 60: Line 60:
 ^ EasyMorph ^ Example ^ JSON ^ Example ^ ^ EasyMorph ^ Example ^ JSON ^ Example ^
 | Text      | ABC     | string ​ | "​ABC" ​  | | Text      | ABC     | string ​ | "​ABC" ​  |
-| Number ​   | 123.45 ​ | number ​ |  123.45 | +| Number ​   |  123.45 | number ​ |  123.45 | 
-| Number (formatted as date)   | 2020-Jan-10 ​ | date  |  2020-01-10T00:​00:​00Z |+| Number (formatted as date)   ​| ​ 2020-Jan-10 | date  |  2020-01-10T00:​00:​00Z |
 | Boolean ​  ​| ​ TRUE  | boolean ​ | true  | | Boolean ​  ​| ​ TRUE  | boolean ​ | true  |
 | Empty     ​| ​     | null     | null  | | Empty     ​| ​     | null     | null  |
Line 69: Line 69:
  
 ==== Nesting JSON objects ==== ==== Nesting JSON objects ====
-EasyMorph detects if a text value already ​is a JSON object or JSON array. In this case, such text value is inserted verbatim, **without** wrapping ​with double quotes. This feature allows creating complex hierarchical JSON objects that nest other JSON objects. For instance converting the table below:+EasyMorph ​automatically ​detects if a text value is already ​a JSON object or JSON array. In this case, the text value is inserted verbatim, ​i.e. **without** wrapping ​in double quotes. This feature allows creating complex hierarchical JSON objects that nest other JSON objects. For instance converting the table below:
  
 ^ Track ^ Country ​ ^ State/​province ^ City     ^ Location ^ Hiatus ^  ^ Track ^ Country ​ ^ State/​province ^ City     ^ Location ^ Hiatus ^ 
Line 89: Line 89:
 } }
 </​code>​ </​code>​
-Notice that Location is inserted as a JSON object, not as text. Field "​Hiatus"​ is inserted as a JSON array, not as text too.+Notice that "Location" ​is inserted as a JSON object, not as text. Also, field "​Hiatus"​ is inserted as a JSON array, not as text.
  
 ==== See also ==== ==== See also ====
transformations/constructjson.1578775446.txt.gz · Last modified: 2020/01/11 20:44 by dmitry