JSON Support
JSON documents can be created in PhixFlow using theĀ toJsonĀ function and the output modified using the following notations.
Curly BracketsĀ { }
Use curly brackets to create an object, e.g.Ā
{ "FirstName" : "John", "LastName" : "Smith", "Age" : 50 }Ā
Colon : and Dot .Ā
- Use a colon to define a key-value pair,Ā e.g.Ā
{ "key" : "value"Ā }
Ā- The key must always evaluate to be a string
- The value must always evaluate to be a string,Ā number, object,Ā array,Ā boolean orĀ null
- Use a dot to access the key and value, e.g.Ā
$foo.key:$foo.value
Ā
In PhixFlow version 11.3+, JSON parsing in expressions ignores any key-value pair where the value is unavailable.
Example using curly brackets, colon and dot
At @ and Dollar $
- @ can be used to reference the current object
- It allows access to any key-value pairs that have already been set
- Use the syntax
@.^.
to traverse upwardsĀ
- $ can be used to reference the outer object of the current object being created
- It will allow access to anyĀ key-value pairs that have already been setĀ
Example usingĀ @Ā
Example using $
Date Handling
JSON support now automatically converts date and date-time values into a their corresponding string representation.
The output format is:
- YYYY-MM-DDTHH:mm:ss.SSS.Z
- For example: 2024-09-13T16:19:10.000Z
SeeĀ Date and Time Format Patterns