Save as JSON – Output Names extensions to format JSON
Query Builder is used to create datasets which can then be save in various formats including CSV,XML and JSON. The Query Builder dataset is a flat table so by default the fields records will be save as an JSON array where the names of the fields use the Output Names in the query. If a sub class or sub array is required in the JSON object then Ouput Name extension attributes can be used to assist the JSON render in getting the desired format.
In most cases the JSON content will be produced by one of the following methods.
- Web Channel REST API url DataSource with Json parameters
- Scheduler with Query or Publisher Actions to Save As JSON file
- Query Builder Preview – Save As JSON menu
Sub Class
- {FieldName}_JsonObjStart_{SubClassName}
- {FieldName}_JsonObjMiddle
- {FieldName}_JsonObjEnd
Value Array
- {FieldName}_JsonArrayStart
- {FieldName}_JsonArrayMiddle
- {FieldName}_JsonArrayEnd
Inline JSON
- {FieldName}_JsonRaw
Data Type
- {FieldName}_DataType_Boolean – > true or false
- {FieldName}_DataType_Date – > “2014-06-02”
- {FieldName}_DataType_DateTime – > “2014-06-02 13:45:30”
- {FieldName}_DataType_DateTime_z – > “2014-06-02T13:45:30Z” (This is the default)
- {FieldName}_DataType_DateTime_s – > “2014-06-02T13:45:30”
- {FieldName}_DataType_DateTime_u – > “2009-06-15 13:45:30Z”
- {FieldName}_DataType_DateTime_r – > “Mon, 15 Jun 2009 20:45:30 GMT”
- {FieldName}_DataType_Date_js – > new Date(2014,5,2)
- {FieldName}_DataType_DateTime_js – > new Date(2014,5,2,10,30,45,1000)
- {FieldName}_DataType_DateTime_js_Unix – > new Date(1268524800000)
Query Builder Showing JSON Output Name extensions
Output Expression is used to create text which is treated as inline JSON which the suffix _JsonRaw is applied to the output name
Query Builder Preview of data with right click menu – Save As JSON
JSON Data
Scheduler Task showing Query Save as JSON Action. Query Combinations can be used to repeat the action with different parameters
Publisher showing the URL link to get the JSON data via the Web Channel REST API
