Unable to Parse JSON String in SET Node Expressions (n8n Cloud)

Problem Summary

I’m working on a VAPI webhook integration in n8n Cloud and receiving JSON data where the arguments field comes through as a JSON string rather than an object. I need to parse this string to access individual fields, but every method I’ve tried in SET node expressions returns undefined or null.

Current Setup

  • Platform: n8n Cloud

  • Workflow: VAPI voice AI webhook → n8n processing

  • Issue: The arguments field contains a JSON string that needs to be parsed

Data Structure

The incoming data looks like this:

json

{
  "functionName": "send_confirmation",
  "arguments": "{\"appointment_id\":\"13\",\"customer_name\":\"John Smith\",\"customer_email\":\"[email protected]\",\"customer_phone\":\"+19045551234\"}"
}

The arguments field is a string, not an object, so I cannot directly access $json.arguments.appointment_id.

What I’ve Tried

Attempt 1: Using .toJsonObject() method

Based on the n8n documentation for string transformation functions, I tried:

{{ $json.arguments.toJsonObject().appointment_id }}

Result: Returns undefined

Attempt 2: Using bracket notation with .toJsonObject()

{{ $json.arguments.toJsonObject()["appointment_id"] }}

Result: Returns undefined

Attempt 3: Using JSON.parse() in expressions

{{ JSON.parse($json.arguments)["appointment_id"] }}

Result: Returns null

Attempt 4: Using JSON.parse() with = prefix

={{ JSON.parse($json.arguments)["appointment_id"] }}

Result: Returns literal "=" character

Attempt 5: Setting field type to Object in SET node

  • Created field parsedArgs with type Object

  • Set value to {{ $json.arguments }}

  • Result: Field shows garbled data, not a parsed object

What I Cannot Use

  • Code nodes: These don’t work in n8n Cloud (known bug where they receive input but produce no output)

  • Function nodes: Not available in my n8n Cloud instance

Questions

  1. What is the correct way to parse a JSON string in SET node expressions in n8n Cloud?

  2. Why does .toJsonObject() (documented in the string transformation functions) return undefined?

  3. Is there a native n8n node type specifically for parsing JSON strings that I’m missing?

  4. Are there known limitations with JSON parsing in n8n Cloud vs self-hosted?

Workarounds I’m Considering

  1. Creating an external microservice/webhook to parse JSON and return the fields

  2. Modifying the source (VAPI) to send parsed objects instead of JSON strings

  3. Using hardcoded values for testing (not viable for production)

Additional Context

  • The workflow successfully processes the data up to this point

  • All other nodes work correctly

  • The arguments string is valid JSON (verified with JSON validators)

  • Other fields in the same data structure are accessible normally

Any guidance would be greatly appreciated! This is blocking completion of an otherwise functional multi-tenant voice AI receptionist workflow.

Environment Details

  • n8n Cloud (latest version)

  • Webhook trigger receiving data from VAPI.ai

  • MySQL database backend

  • Split Out node successfully splitting tool calls array

  • SET nodes for data transformation

Thank you in advance for any help!

You were almost there. This should work:

JSON.parse($json.arguments).appointment_id

Thanks for the quick response! Unfortunately, I’m still running into issues getting JSON.parse($json.arguments).appointment_id to work.

What I’ve Tried

Following your suggestion, I’ve tested the expression in a SET node with different configurations:

1. Expression Mode (with = prefix):

  • Expression: JSON.parse($json.arguments).appointment_id

  • Result: Output shows literal text "JSON.parse($json.arguments).appointment_id" instead of the parsed value

2. Fixed Mode (with {{ }} wrappers):

  • Expression: {{ JSON.parse($json.arguments).appointment_id }}

  • Result: Output shows the full expression as literal text: "{{ JSON.parse($json.arguments).appointment_id }}"

3. In SQL query (MySQL node):

  • SQL: WHERE a.id = {{ JSON.parse($json.arguments).appointment_id }}

  • Result: Error - Unknown column 'undefined' in 'WHERE'

My Data Structure

The incoming data clearly has the arguments field as a JSON string:

json

{
  "functionName": "send_confirmation",
  "arguments": "{\"appointment_id\":\"13\",\"customer_name\":\"John Smith\",\"customer_email\":\"[email protected]\"}"
}

I can see this in the INPUT of my SET node, so I know $json.arguments exists and contains the JSON string.

Question

Is there a specific node configuration or syntax I’m missing to make JSON.parse() actually evaluate the expression rather than treating it as literal text?

I’m on n8n Cloud (latest version), and Code nodes don’t work in my environment. I need to parse this JSON string using SET nodes or another available node type.

Any guidance would be greatly appreciated! I’m so close to finishing this workflow - this is the last blocker.

Thanks again for your help!

Hi, I wonder what your incoming node and format is but I tried to set it up with two nodes. It has the same suggestion/syntax but maybe it helps debugging .

Again with pinned data

Need Help: JSON String Parsing in n8n Cloud + VAPI Webhook Integration (Willing to Pay)

Summary

I’m building a multi-tenant VAPI voice AI receptionist workflow in n8n Cloud that processes webhooks from VAPI.ai. I’m stuck on parsing JSON strings from the webhook payload and running into the Code node output bug. I’m willing to pay someone to walk me through this and help me fix it.

The Problem

VAPI sends function arguments as a JSON string rather than a parsed object:

json

{
  "message": {
    "toolCallList": [
      {
        "function": {
          "name": "check_availability",
          "arguments": "{\"date\":\"2024-01-15\",\"time\":\"14:00\",\"service\":\"property_showing\"}"
        }
      }
    ]
  }
}

I need to parse that arguments string into an actual object so I can use the values in my workflow.

What I’ve Tried

All of these approaches have failed or produced unreliable results in n8n Cloud:

  1. JSON.parse() in expressions:
   {{ JSON.parse($json.message.toolCallList[0].function.arguments) }}
  1. toJsonObject() method:
   {{ $json.message.toolCallList[0].function.arguments.toJsonObject() }}
  1. Code nodes: I’ve hit the known n8n Cloud bug where Code nodes receive input but produce no output

  2. HTTP Request node with JSONPath: Doesn’t apply here since this is about parsing within the workflow

  3. Expression with manual parsing: Too complex and error-prone

Additional Context

  • Platform: n8n Cloud (not self-hosted)

  • Webhook source: VAPI.ai function calling system

  • Use case: Multi-tenant voice AI system routing calls to MySQL database operations

  • Current workaround: None - this is blocking my entire workflow

The workflow successfully:

  • Receives webhooks from VAPI ✓

  • Routes to different outputs based on function name ✓

  • Handles all database operations (when I manually provide the data) ✓

But I cannot extract the actual parameter values from the JSON string.

What I Need

I need help with the proper n8n Cloud approach to:

  1. Parse the JSON string from function.arguments

  2. Extract individual values (date, time, service, etc.)

  3. Pass those values to downstream MySQL nodes

I’m willing to pay for a 1-on-1 session to walk through this issue and get my workflow working. This is for a production system and I need a reliable solution.

Question

What is the recommended approach in n8n Cloud for parsing JSON strings in webhook payloads when Code nodes aren’t reliable and standard expression methods don’t work?


If you’re experienced with n8n Cloud and VAPI/webhook integrations, please reach out. I’m happy to compensate you for your time to help resolve this. You can reply here or DM me.

Thank you!

If your JSON string is nested or more complex, you can use JMESPath or the .parseJson() helper in expressions to extract values.

Maybe this helps :slight_smile: . Worth giving try.

P.S Code node is reliable.

1 Like

Thank you Parintele! That was what I needed to get this to work. I appreciate your help!

1 Like

Hey !

Glad that I could help!

Please mark as solved the answer that you think resolved your issue, so others can benefit from this :wink:.

Have fun!

Marking this as solved. thank you guys for your help!

You have to select an answer, and mark “Solved”.