New Object as JSON
Audience:
Low-code EngineersSkill Prerequisites:
Actions,Tokens,APIs,JSON
Returns a JSON object as the response of an API endpoint. You list the properties as name/value pairs, and the values can contain tokens.
This action is only available in APIs. It's a final action: it ends the API method, and no actions after it run.
Typical Use Cases
- Return a simple result, for example
{"success":"true","id":"1001"}after saving a record - Return an error object with a matching status code, for example
400with amessageproperty - Return values from tokens, such as API inputs, query results or the current user
Don't use it to
- Return nested JSON, arrays, or numbers and booleans as real JSON types. Build the JSON with Create JSON Object and return it with Raw Response.
- Return the entries of a list. Use Existing List as JSON or Existing Object as JSON instead.
- Build JSON to use later, for example to send to another API. Use Create JSON Object instead, which saves it in a token.
Related Actions
| Action Name | Description |
|---|---|
| Raw Response | Returns any content, for example JSON built with Create JSON Object. |
| Create JSON Object | Builds JSON with types and nesting, and saves it in a token. |
| Existing Object as JSON | Returns one list entry as a JSON object. |
| Existing List as JSON | Returns a list as a JSON array. |
| File Response | Returns a file. |
| Download File | Sends a file to download. |
Input Parameter Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Http code | The HTTP status code of the response, for example 200, 201 or 400 Bad Request. You can add a description after the number, separated by a space. If it's empty, the status is 200. | Yes | empty string | No |
| Properties | The properties of the JSON object. Each row has a Name, for example id, and a Value, for example [OrderId]. See Response. | Yes | empty | No |
| HTTP Headers | Extra response headers. Each row has a Name, for example Location, and a Value, for example /api/orders/[OrderId]. Content-Type is application/json unless you set it here. | Yes | empty | No |
| Allow JSONP | When the request has a callback query string parameter, wraps the JSON in a call to that function, for example myFunction({...}), and sets Content-Type to application/javascript. Without callback, the JSON is returned as usual. | No | false | No |
Response
The response is one flat JSON object, with the properties in the order of the rows.
{"success":"true","id":"1001","message":"Order SO-1001 was created."}
- Every value is a JSON string.
true,1001or a token that holds a number are written as"true"and"1001". - Values are escaped. Quotes and special characters are escaped, so the response is always valid JSON. A token that holds JSON, for example
[OrderJson], is written as one escaped string, not as a nested object. To nest JSON, use Create JSON Object and Raw Response. - Names aren't case-sensitive.
idandIdare the same property. If two rows have the same name, only one property is written, with the name of the first row and the value of the last. - Rows with an empty Name are skipped. With no rows, the response is
{}.
Considerations
- APIs only. The action is only available in API methods. In other modules, use Create JSON Object to build JSON in a token.
- It ends the method. No actions after it run. Put it last, or give it a condition to return different responses, for example a
400response when an input is missing. See Common Parameters. - Http code format. It must start with a number, for example
201or201 Created. Other values make the API return an error. - Conditions. In a condition, token values are substituted in quotes, so write
[email] == "", not"[email]" == "".
Examples
To understand how to use the below examples, please see Running Examples.
1. Return the ID of a new order
This action returns 201 Created with the ID of the order saved by an earlier action. The Location header points to the new order.
{
"Title": "New Object as JSON",
"ActionType": "JsonObject",
"Description": "Return the new order ID",
"Parameters": {
"HttpCode": "201 Created",
"Fields": [
{
"name": "success",
"value": "true"
},
{
"name": "id",
"value": "[OrderId]"
}
],
"Headers": [
{
"name": "Location",
"value": "/api/orders/[OrderId]"
}
],
"AllowJsonp": false
}
}
2. Return an error when an input is missing
This action returns 400 with an error message when the email input of the API method is empty. Put it before the actions that use email.
{
"Title": "New Object as JSON",
"ActionType": "JsonObject",
"Description": "Reject requests without an email",
"Condition": "[email] == \"\"",
"Parameters": {
"HttpCode": "400 Bad Request",
"Fields": [
{
"name": "success",
"value": "false"
},
{
"name": "message",
"value": "The email parameter is required."
}
],
"Headers": [],
"AllowJsonp": false
}
}
Revised 09/27/2026