Context to JSON Object
Audience:
Low-code EngineersSkill Prerequisites:
Actions,Tokens
Saves the tokens in the current context as a JSON object, and stores it in a token. Each token name becomes a property. You can limit which tokens are included by the start of their names, and group sub-tokens into nested objects.
{
"FirstName": "Jane",
"Quantity": "3"
}
Typical Use Cases
- See which tokens exist while you build an application, and what their values are
- Log the state of a form or workflow at a certain point, for example with Log Event
- Send a group of tokens to an API or webhook as one JSON object, for example with Server Request
- Save a set of values in one database column, and read it back later with Parse JSON Into Tokens
Don't use it to
- Get a Name/Value list. Use Context to JSON Array instead.
- Build JSON with specific properties, types or deep nesting. Use Create JSON Object instead.
- Show the token list to end users. It can contain internal or sensitive values.
Related Actions
| Action Name | Description |
|---|---|
| Context to JSON Array | Saves the context tokens as a Name/Value array instead of an object. |
| Parse JSON Into Tokens | Turns a JSON string back into tokens. |
| Create JSON Object | Builds a JSON object from properties you define. |
| Create/Update Tokens | Creates or changes tokens in the context. |
Input Parameter Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Store Result | The name of the token that receives the JSON object, for example ContextJson. Enter the name without brackets. If it's empty, the action fails with No token name has been provided for the result. | No | empty string | Yes |
| Include Prefixes | Token name prefixes to include, one per line. Only tokens whose names start with one of them are included, for example customer includes customerName and customerEmail. Leave it empty to include all tokens. | Yes | empty string | No |
| Exclude Prefixes | Token name prefixes to leave out, one per line, for example customerAddress leaves out customerAddress1 and customerAddress2. Leave it empty to exclude nothing. | Yes | _, $ and QueryString, one per line | No |
| Generate Nested Object | When checked, sub-tokens (names with a :, such as Photo:FileName) are grouped into an object under the main token name. When unchecked, every token is a top-level property with its full name. | No | false | No |
Output Parameters Reference
| Parameter | Description |
|---|---|
| Store Result | The token named in Store Result. It contains the JSON object, with one property per included token. |
How tokens are selected
- Prefixes are compared with the start of each token name, ignoring case.
customermatchesCustomerName. - Exclude Prefixes wins. A token that matches both lists is left out.
- The default exclude list leaves out tokens starting with
_or$, which are mostly internal, andQueryStringtokens. Clear it to see everything. - Prefixes aren't trimmed. A line with a trailing space won't match.
Nested objects
Many tokens have sub-tokens, written with a :. For example, a file upload field named Photo creates Photo:FileName, Photo:MimeType and others.
With Generate Nested Object unchecked, they're separate properties:
{
"Photo": "vacation.jpg",
"Photo:FileName": "vacation.jpg",
"Photo:MimeType": "image/jpeg"
}
With it checked, they're grouped under Photo:
{
"Photo": {
"FileName": "vacation.jpg",
"MimeType": "image/jpeg"
}
}
- The main value is dropped. When a token has sub-tokens, its own value,
Photoabove, isn't in the nested result. - One level only. The name is split at the first
:only. Tokens with more than one:, likeA:B:C, can make the action fail. Leave them out with Exclude Prefixes or Include Prefixes.
Considerations
- All values are strings. Numbers, booleans and JSON text are written as strings, for example
"3"and"true". Empty values are written as"". - Some values aren't shown. Tokens that are calculated only when used, such as the
:Base64token of an uploaded file, get the value(Content not displayed). - Size. Without include prefixes, the result can be large. Use Include Prefixes to keep it small.
- Security. The result can contain user data and internal values. Don't display it to end users or send it to systems that shouldn't see it.
Examples
To understand how to use the below examples, please see Running Examples.
1. Show all tokens while debugging
This action stores all tokens, except the default exclusions, in ContextJson. Show [ContextJson] in a Display Message to inspect it.
{
"Title": "Context to JSON Object",
"ActionType": "ContextToJSONObject",
"Description": "Show all tokens for debugging",
"Parameters": {
"StoreResultName": "ContextJson",
"ExcludePrefixes": "_\n$\nQueryString"
}
}
2. Build a payload from the customer tokens
This action stores the tokens whose names start with customer, except the address tokens, in CustomerJson.
{
"Title": "Context to JSON Object",
"ActionType": "ContextToJSONObject",
"Description": "Build the customer payload",
"Parameters": {
"StoreResultName": "CustomerJson",
"IncludePrefixes": "customer",
"ExcludePrefixes": "customerAddress"
}
}
With the tokens customerName = Jane Doe, customerEmail = jane@example.com and customerAddress1 = 1 Main St, the result is:
{
"customerName": "Jane Doe",
"customerEmail": "jane@example.com"
}
3. Group the details of an uploaded file
This action stores the Photo token and its sub-tokens in PhotoJson, grouped into one object.
{
"Title": "Context to JSON Object",
"ActionType": "ContextToJSONObject",
"Description": "Group the photo details",
"Parameters": {
"StoreResultName": "PhotoJson",
"IncludePrefixes": "Photo:",
"ExcludePrefixes": "",
"NestedObject": true
}
}
The result looks like { "Photo": { "FileName": "vacation.jpg", "MimeType": "image/jpeg", ... } }.
Revised 09/26/2026