Has one parameter, Options
Description
Used to stream the Work Query into a JSON string. Because the data source is the Work Query, the correct operator for the assignment of the output to a Top Query field is |.
Options
The following Options are available and may be space-separated for valid combinations. The default used if blank is just the single value of "Array".
When the output data includes the case-sensitive text values of null, true, and false, these will be preserved as-is and will not be treated as strings. Empty strings will be output as "". Empty arrays will be output as [ ].
Warning: Careful consideration must be given prior to using any function that unescapes HTML prior or API or HTTP output; as JSON escaped data or otherwise. Consider carefully if the calling system(s) are expecting the data to be websafe (clean and ready to display in a web browser) or not. If unescaped data is sent to the client, it is critical that the client ensures that data is safe to display prior to placing it in the web browser's DOM.
Note: Use the HttpType command with HttpType "application/json"
for API calls, or to view in browser with JSON formatting.
Example Output for Typical Options
The Format option is used here for readability, but should not typically be used in production.
[New] JOut | JsonStream$ "Single Object Format"
{ "Alias": 10101, "Firstname": "DB Admin", "Lastname": "LocalHost", "Email": "[email protected]" }
[New] JOut | JsonStream$ "Single Array Format"
[ 10101, 10102, "1D9BB784ED8CE4051A7F6F9FFFDD1789", "F2EB7F85D4932272D0789FE005B9C64C" ]
LoadTable "MemTab.Person"
Children "MemTab.Group"
JsonEmbed "MemTab.Person.Alias", "Group", "MemTab.Group.Type", "Single Array"
KeepUnique "MemTab.Person.Alias
Children "Finance.Product"
JsonEmbed "MemTab.Person.Alias", "Product", "Finance.Product.|Alias|Name|Type|Image|Intro|Body", "Object Array"
KeepUnique "MemTab.Person.Alias"
KeepFields "MemTab.Person.|Alias|Firstname|Lastname|Email Groups Product"
[New] JOut | JsonStream$ "Object Array Embed Format"
[ { "Alias": 10101, "Firstname": "DB Admin", "Lastname": "LocalHost", "Email": "[email protected]", "Groups": [ "DB Admin", "Private" ], "Product": [ { "Alias": 50101, "Name": "ACME 101", "Type": "TBD" }, { "Alias": 50102, "Name": "ACME 102", "Type": "TBD" } ] }, { "Alias": 10102, "Firstname": "Tom", "Lastname": "Smith", "Email": "[email protected]", "Groups": [], "Product": [ { "Alias": 50103, "Name": "ACME 103", "Type": "TBD" }, { "Alias": 50104, "Name": "ACME 104", "Type": "TBD" } ] } ]
JsonStream$ "Array Format"
[ [ 10101, "DB Admin", "LocalHost", "2021-12-09", "Male", "[email protected]", "2021-12-09 04:07:25" ], [ 10102, "Tom", "Smith", "", "Male", "[email protected]", "2021-12-22 15:33:29" ] ]
JsonStream$ "Array Header Format"
[ [ "Alias", "Firstname", "Lastname", "Birthdate", "Gender", "Email", "Modified" ], [ 10101, "DB Admin", "LocalHost", "2021-12-09", "Male", "[email protected]", "2021-12-09 04:07:25" ], [ 10102, "Tom", "Smith", "", "Male", "[email protected]", "2021-12-22 15:33:29" ] ]
LoadTable "MemTab.Person"
Children "MemTab.Group"
JsonEmbed "MemTab.Person.Alias", "Group", "MemTab.Group.Type", "Single Array"
KeepUnique "MemTab.Person.Alias
KeepFields "MemTab.Person.|Alias|Firstname|Lastname|Email Groups"
LTrimFields "MemTab."
[New] JOut | JsonStream$ "Object Embed FullNames Format"
{ "10101": { "Person.Firstname": "DB Admin", "Person.Lastname": "LocalHost", "Person.Email": "[email protected]", "Groups": [ "DB Admin", "Private" ] }, "10102": { "Person.Firstname": "Tom", "Person.Lastname": "Smith", "Person.Email": "[email protected]", "Groups": [] } }