Skip to content

JSON Stringify

The JSON Stringify node converts the entire pipeline input into a JSON string. Use it when you need to pass structured data as a string -- for example, as an HTTP request body or for storing in a text field.

Configuration

This node has no configuration options. It converts whatever it receives into JSON.

Input

Accepts any data type -- arrays, objects, scalars.

Output

Returns a JSON string representation of the input.

Example

Input:

json
[
  { "id": 1, "name": "Widget A" },
  { "id": 2, "name": "Widget B" }
]

Output:

"[{\"id\":1,\"name\":\"Widget A\"},{\"id\":2,\"name\":\"Widget B\"}]"

How It Works

The node calls wp_json_encode() on the entire input and returns the resulting string.

Example Use Cases

Prepare an HTTP request body

Table Query --> Pick Fields (id, name) --> JSON Stringify --> HTTP Request (body = input)

Store computed data as a JSON column

Context --> Set Field --> JSON Stringify --> Save Row

Debug data inspection

Convert pipeline data to a readable JSON string for display in a text widget.

TIP

This is the inverse of JSON Parse. JSON Parse converts a string to structured data; JSON Stringify converts structured data to a string.