Clay Icon

Guidance on Sending Complex JSON in HTTP Requests with Clay

·
·

Hey Clay team, I'm having difficulty with a complex JSON formula that includes multiple variables. I'm trying to send an HTTP request with a large prompt that includes: 1. String tokens (Text, URL) 2. A nested JSON array variable (List of items) When using Formula Mode with proper escaping I'm still getting a "Failed to parse body input" error with "Bad control character in string literal in JSON at position XX". The same formula works perfectly when I remove the tokens and use plain text, so I believe it's related to how Clay handles the insertion of complex nested JSON (particularly lists). Could you please advise on the correct approach for including both string tokens and nested JSON lists in a complex HTTP request body? Is there a specific syntax I should be using for these different token types? If there is a comprehensive guide or a video on how to do this it would be amazing! Thank you!

  • Avatar of Channeled
    Channeled
    APP
    ·
    ·

    To include string tokens and nested JSON lists in a complex HTTP request body using Formula Mode in Clay: 1. Ensure proper JSON formatting: • Use double quotes for keys and string values • Don't use quotes for numbers or booleans • Separate key-value pairs with commas 2. For dynamic string variables: • Enclose them in quotation marks • Example: "name": "##{{name field}}" 3. For nested JSON arrays: • Use square brackets [] • Separate items with commas 4. When combining plain text with dynamic column tags, create a Formula column first, then include that column (with quotes) in your body. To troubleshoot further, please copy and paste your JSON into the chat so we can identify any specific issues.

  • Avatar of Channeled
    Channeled
    APP
    ·
    ·
  • Avatar of Channeled
    Channeled
    APP
    ·
    ·

    This thread was picked up by our in-app web widget and will no longer sync to Slack. If you are the original poster, you can continue this conversation by logging into https://app.clay.com and clicking "Support" in the sidebar. If you're not the original poster and require help from support, please post in 02 Support.

  • Avatar of Channeled
    Channeled
    APP
    ·
    ·

    Thanks! We've reopened this thread. You can continue to add more detail directly in this thread.