Skip to main content
Version: 1.28 (Current)

Context to JSON Object

Audience: Low-code Engineers

Skill 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.
Action NameDescription
Context to JSON ArraySaves the context tokens as a Name/Value array instead of an object.
Parse JSON Into TokensTurns a JSON string back into tokens.
Create JSON ObjectBuilds a JSON object from properties you define.
Create/Update TokensCreates or changes tokens in the context.

Input Parameter Reference​

ParameterDescriptionSupports TokensDefaultRequired
Store ResultThe 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.Noempty stringYes
Include PrefixesToken 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.Yesempty stringNo
Exclude PrefixesToken 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 lineNo
Generate Nested ObjectWhen 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.NofalseNo

Output Parameters Reference​

ParameterDescription
Store ResultThe 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. customer matches CustomerName.
  • 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, and QueryString tokens. 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, Photo above, isn't in the nested result.
  • One level only. The name is split at the first : only. Tokens with more than one :, like A: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 :Base64 token 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​

tip

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