Expressions not resolving in HTTP Request despite correct data structure - {{$json.title}} shows red and returns empty

##Clear explanation:

  • I have a workflow where data flows from a Code node to an HTTP Request node, but expressions aren’t resolving despite following all documentation.
  • Hardcoded/static values work perfectly - when I use “title”: “Test Post” instead of “title”: “{{$json.title}}”, WordPress posts are created successfully
  • screenshots attached

##What’s working:

  • My WordPress setup works
  • My HTTP Request configuration works
  • The issue seems to be specifically with expression resolution, not the API or authentication
  • Code node outputs correct data structure: {title: “…”, content: “…”, status: “draft”}
  • INPUT tab of HTTP Request shows the data is there
  • Static values in HTTP Request work fine and create posts

##What’s broken:

  • Expressions like {{$json.title}} show red highlighting in the JSON editor
  • Preview shows {“title”: “”, “content”: “”, “status”: “”} (empty strings)
  • WordPress receives empty content despite data being available

##What I’ve tried:

  • Multiple expression formats: {{$json.title}}, {{$(‘NodeName’).first().json.title}}
  • Both Fixed and Expression modes
  • Verified data structure follows n8n documentation
  • Updated n8n to latest version
  • Tested with Form Parameters vs JSON body

The workflow creates posts successfully with static content, but expressions consistently fail to resolve. The data is definitely there (visible in INPUT tab) but something is preventing expression evaluation.

Workflow attached. Any ideas what could cause expressions to not resolve despite correct data flow?

##Info on my n8n setup

  • version 1.100.1
  • Running n8n in desktop app

I have worked on this for hours (also with claude Sonnet 4 referencing community and documentation) and really appreciate any dumbed down help since I’m only 6 months into n8n and still learning. Thanks so much.





{
  "name": "My workflow 3",
  "nodes": [
    {
      "parameters": {},
      "id": "bd36ba4f-5d8f-4f0f-9219-61d7b4626215",
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "searchTerm",
              "value": "table saw"
            },
            {
              "name": "brand"
            },
            {
              "name": "priceRange",
              "value": "all"
            }
          ]
        },
        "options": {}
      },
      "id": "51b37feb-3fd7-440d-b6c6-779f95b93f10",
      "name": "Set Search Parameters",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        200,
        0
      ]
    },
    {
      "parameters": {
        "authentication": "basicAuth",
        "url": "={{$json[\"searchUrl\"]}}",
        "responseFormat": "string",
        "options": {}
      },
      "id": "a7163692-8176-413d-96be-851c0981a1be",
      "name": "Fetch Amazon Results",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        600,
        0
      ],
      "retryOnFail": true,
      "credentials": {
        "httpBasicAuth": {
          "id": "uMPkGHkN9rTF9cJH",
          "name": "Unnamed credential 3"
        }
      }
    },
    {
      "parameters": {
        "functionCode": "// Mock Amazon search results for testing\n// In production, this would parse the actual HTML from Amazon\n\nconst searchTerm = $input.all()[0].json.searchTerm;\n\n// Simulated product data\nconst mockProducts = [\n  {\n    asin: 'B08GC6PL3D',\n    name: 'DEWALT Table Saw for Jobsite, Compact 8-1/4-Inch',\n    price: 299.00,\n    rating: 4.7,\n    reviewCount: 5823,\n    salesRank: 1,\n    brand: 'DEWALT',\n    url: 'https://www.amazon.com/dp/B08GC6PL3D'\n  },\n  {\n    asin: 'B00OG4X1HO',\n    name: 'BOSCH 10 In. Worksite Table Saw with Gravity-Rise Stand',\n    price: 699.00,\n    rating: 4.5,\n    reviewCount: 1256,\n    salesRank: 2,\n    brand: 'BOSCH',\n    url: 'https://www.amazon.com/dp/B00OG4X1HO'\n  },\n  {\n    asin: 'B07KXVMQPW',\n    name: 'SKIL 15 Amp 10 Inch Portable Jobsite Table Saw with Folding Stand',\n    price: 399.99,\n    rating: 4.4,\n    reviewCount: 2341,\n    salesRank: 3,\n    brand: 'SKIL',\n    url: 'https://www.amazon.com/dp/B07KXVMQPW'\n  },\n  {\n    asin: 'B0000225T8',\n    name: 'Makita 2705 10-Inch Contractor Table Saw',\n    price: 549.00,\n    rating: 4.6,\n    reviewCount: 892,\n    salesRank: 4,\n    brand: 'Makita',\n    url: 'https://www.amazon.com/dp/B0000225T8'\n  },\n  {\n    asin: 'B01G7C0DQS',\n    name: 'CRAFTSMAN Table Saw, 10-Inch, 15-Amp',\n    price: 479.00,\n    rating: 4.3,\n    reviewCount: 1567,\n    salesRank: 5,\n    brand: 'CRAFTSMAN',\n    url: 'https://www.amazon.com/dp/B01G7C0DQS'\n  }\n];\n\n// Add search category to each product\nconst productsWithCategory = mockProducts.map(product => ({\n  ...product,\n  searchCategory: searchTerm,\n  searchRelevance: 1.0\n}));\n\nreturn productsWithCategory.map(product => ({ json: product }));"
      },
      "id": "b0a55bdf-f25d-4085-9d1d-5b51315c3544",
      "name": "Parse Products (Mock)",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        800,
        0
      ]
    },
    {
      "parameters": {
        "functionCode": "// Filter and rank products\nconst products = $input.all().map(item => item.json);\n\n// Calculate composite score for ranking\nconst rankedProducts = products.map(product => {\n  const ratingScore = product.rating;\n  const reviewScore = Math.log10(product.reviewCount + 1);\n  const rankScore = 10 - product.salesRank;\n  const compositeScore = (ratingScore * reviewScore * rankScore) / 10;\n  \n  return {\n    ...product,\n    compositeScore: compositeScore\n  };\n});\n\n// Sort by composite score\nrankedProducts.sort((a, b) => b.compositeScore - a.compositeScore);\n\n// Select random from top 3\nconst topProducts = rankedProducts.slice(0, 3);\nconst selectedIndex = Math.floor(Math.random() * topProducts.length);\nconst selectedProduct = topProducts[selectedIndex];\n\n// Add metadata\nselectedProduct.selectionDate = new Date().toISOString();\nselectedProduct.totalCandidates = products.length;\nselectedProduct.selectionRank = selectedIndex + 1;\n\nreturn [{ json: selectedProduct }];"
      },
      "id": "13571194-ae24-448e-a879-ae1583a97b01",
      "name": "Select Product",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        1000,
        0
      ]
    },
    {
      "parameters": {
        "functionCode": "// Add mock product details for testing\nconst product = $input.first().json;\n\n// Simulated detailed product data\nconst detailedProduct = {\n  ...product,\n  specifications: [\n    '15 Amp motor generates 5,000 RPM for extended durability and life',\n    '24-1/2 inch rip capacity for ripping through large sheet materials',\n    'Telescoping fence rails retract to create a small, portable package',\n    'On-board storage for safety equipment and accessories',\n    'Metal roll cage protects the saw from jobsite drops and impacts'\n  ],\n  recentReviews: [\n    {\n      title: 'Great saw for the price',\n      text: 'This table saw exceeded my expectations. The fence is accurate and the motor has plenty of power.',\n      rating: 5,\n      date: '2024-01-15'\n    },\n    {\n      title: 'Good for DIY projects',\n      text: 'Perfect for my home workshop. Easy to set up and use. The dust collection could be better.',\n      rating: 4,\n      date: '2024-01-10'\n    }\n  ],\n  technicalDetails: {\n    'Item Weight': '45 pounds',\n    'Product Dimensions': '26.8 x 22 x 13 inches',\n    'Power Source': 'Corded Electric',\n    'Voltage': '120 Volts',\n    'Blade Length': '10 Inches'\n  },\n  description: 'Professional-grade table saw designed for jobsite use with powerful motor and durable construction.'\n};\n\nreturn [{ json: detailedProduct }];"
      },
      "id": "3668d02a-ab13-473d-b1ed-2aad94e7604f",
      "name": "Add Product Details",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        1200,
        0
      ]
    },
    {
      "parameters": {
        "functionCode": "// Generate Review - Actually create the review content\nconst product = $input.first().json;\n\n// Safety checks\nif (!product.name) product.name = 'Professional Tool';\nif (!product.brand) product.brand = 'Premium';\nif (!product.searchCategory) product.searchCategory = 'tool';\nif (!product.price) product.price = 299;\nif (!product.rating) product.rating = 4.5;\nif (!product.reviewCount) product.reviewCount = 1000;\nif (!product.description) product.description = 'High-quality professional tool designed for demanding applications.';\nif (!product.specifications || !Array.isArray(product.specifications)) {\n  product.specifications = ['Advanced motor technology for professional use', 'Durable construction for extended lifespan', 'Precision engineering for accurate results'];\n}\n\n// Generate actual review content\nconst reviewContent = `# ${product.name} Review: Best ${product.searchCategory} for 2024\n\n## Quick Summary\nThe ${product.name} offers excellent value for both professional contractors and serious DIYers. With its ${product.specifications[0].toLowerCase()} and solid build quality, it stands out in the competitive ${product.searchCategory} market.\n\n## Key Features\n${product.specifications.map(spec => `- ${spec}`).join('\\n')}\n\n## Performance Testing Results\nDuring my testing, the ${product.name} handled various materials with ease. The motor maintained consistent power and the system remained accurate throughout extended use.\n\n## Final Verdict\nThe ${product.name} is an excellent choice for contractors and serious hobbyists who need a reliable ${product.searchCategory} under $${Math.round(product.price * 1.2)}. Its combination of power, accuracy, and portability makes it one of the best values in the current market.\n\n*Disclosure: As an Amazon Associate, I earn from qualifying purchases.*`;\n\nconsole.log(\"Review content created, length:\", reviewContent.length);\n\nreturn [{\n  json: {\n    ...product,\n    reviewContent: reviewContent,\n    title: `${product.name} Review: Best ${product.searchCategory} for 2024`,\n    wordCount: reviewContent.split(/\\s+/).length\n  }\n}];"
      },
      "id": "69a5753c-9256-4f42-b4a3-162ad1f23212",
      "name": "Generate Review",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        1400,
        0
      ]
    },
    {
      "parameters": {
        "functionCode": "// Format for WordPress - Correct double-nested access\nconst inputData = $input.first().json[0].json;\nconsole.log(\"Direct access - input data:\", inputData);\nconsole.log(\"Available fields:\", Object.keys(inputData));\nconsole.log(\"All field names:\", Object.keys(inputData));\nconsole.log(\"Content available:\", !!inputData.content);\n\nfunction markdownToHtml(markdown) {\n  if (!markdown) return \"Default review content generated.\";\n  \n  return markdown\n    .replace(/^# (.*$)/gm, '<h1>$1</h1>')\n    .replace(/^## (.*$)/gm, '<h2>$1</h2>')\n    .replace(/^### (.*$)/gm, '<h3>$1</h3>')\n    .replace(/^\\*\\*(.*?)\\*\\*/gm, '<strong>$1</strong>')\n    .replace(/^- (.*$)/gm, '<li>$1</li>')\n    .replace(/\\n\\n/g, '</p><p>')\n    .replace(/^(?!<[hl])/gm, '<p>')\n    .replace(/(?<![>])$/gm, '</p>')\n    .replace(/<\\/p><p><li>/g, '<ul><li>')\n    .replace(/<\\/li><\\/p>/g, '</li></ul>')\n    .replace(/<p><\\/p>/g, '');\n}\n\nconst wpPost = {\n  title: inputData?.title || \"Product Review\",\n content: inputData?.reviewContent || inputData?.review || inputData?.description || inputData?.content || \"Fallback content\",\n  status: \"draft\"\n};\n\nconsole.log(\"FINAL - WordPress post:\");\nconsole.log(\"- Title:\", wpPost.title);\nconsole.log(\"- Content length:\", wpPost.content.length);\nconsole.log(\"- Has actual content:\", wpPost.content !== \"Default review content generated.\");\n\nreturn [wpPost];"
      },
      "id": "7de83ba7-0088-475c-937c-ef00e1e1dc23",
      "name": "Format for WordPress",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        820,
        200
      ]
    },
    {
      "parameters": {
        "functionCode": "// Generate final summary\nconst wpData = $input.first().json;\nconst productData = $input.first().json; // This will contain all the product data passed through\n\nconst summary = {\n  success: true,\n  timestamp: new Date().toISOString(),\n  product: {\n    name: productData.name || 'Unknown Product',\n    brand: productData.brand || 'Unknown Brand',\n    price: `$${productData.price || 0}`,\n    rating: `${productData.rating || 0} stars`,\n    asin: productData.asin || 'Unknown ASIN'\n  },\n  wordpress: {\n    title: wpData.title || 'Untitled',\n    status: wpData.status || 'draft',\n    wordCount: wpData.content ? wpData.content.split(/\\s+/).length : 0\n  },\n  nextSteps: [\n    'Review and publish the draft post in WordPress',\n    'Add featured image from product photos',\n    'Insert your Amazon affiliate links',\n    'Schedule social media promotion'\n  ]\n};\n\nreturn [{ json: summary }];"
      },
      "id": "0a2e9d9c-cf59-4514-bcca-d108ee3e7d43",
      "name": "Summary",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        1200,
        200
      ]
    },
    {
      "parameters": {
        "jsCode": "// Build Amazon search URL\nconst searchTerm = items[0].json.searchTerm;\nconst brand = items[0].json.brand || '';\nconst priceRange = items[0].json.priceRange || 'all';\n\n// Validate search term\nif (!searchTerm || searchTerm.trim() === '') {\n  throw new Error('Search term is required');\n}\n\n// Convert to URL-friendly format\nconst urlSearchTerm = encodeURIComponent(searchTerm.trim());\nconst urlBrand = brand ? encodeURIComponent(brand.trim()) : '';\n\n// Build price filter\nlet priceFilter = '';\nswitch(priceRange) {\n  case 'under-100':\n    priceFilter = '&p_36=1-10000';\n    break;\n  case '100-500':\n    priceFilter = '&p_36=10000-50000';\n    break;\n  case 'over-500':\n    priceFilter = '&p_36=50000-';\n    break;\n}\n\n// Build search URL\nlet searchUrl = `https://www.amazon.com/s?k=${urlSearchTerm}`;\nif (urlBrand) {\n  searchUrl += `+${urlBrand}`;\n}\nsearchUrl += '&rh=n%3A228013&s=review-rank' + priceFilter;\n\nreturn [{\n  json: {\n    searchTerm: searchTerm.trim(),\n    brand: brand.trim(),\n    priceRange: priceRange,\n    searchUrl: searchUrl,\n    urlSearchTerm: urlSearchTerm\n  }\n}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        400,
        0
      ],
      "id": "6c1125f3-3cb0-4d08-9ae5-740a9debca55",
      "name": "Code"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://www.craftysaw.com/wp-json/wp/v2/posts",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth",
        "sendHeaders": true,
        "specifyHeaders": "json",
        "jsonHeaders": "={\n  \"title\": \"{{ $json.title }}\",\n  \"content\": \"{{ $json.content }}\",\n  \"status\": \"{{ $json.status }}\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"title\": \"{{$('Format for WordPress').first().json.title}}\",\n  \"content\": \"{{$('Format for WordPress').first().json.content}}\",\n  \"status\": \"draft\"\n}",
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "neverError": true
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        980,
        200
      ],
      "id": "6a322eca-1600-425f-b100-89ae421c3e23",
      "name": "HTTP Request",
      "credentials": {
        "httpBasicAuth": {
          "id": "uMPkGHkN9rTF9cJH",
          "name": "Unnamed credential 3"
        }
      }
    },
    {
      "parameters": {
        "amount": 1
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        620,
        200
      ],
      "id": "3d913201-7d2c-402b-b2f7-d65d90aff89f",
      "name": "Wait",
      "webhookId": "35b9087b-6f5f-4bdf-88cd-7c257adf8427"
    }
  ],
  "pinData": {},
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Set Search Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Search Parameters": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Amazon Results": {
      "main": [
        [
          {
            "node": "Parse Products (Mock)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Products (Mock)": {
      "main": [
        [
          {
            "node": "Select Product",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select Product": {
      "main": [
        [
          {
            "node": "Add Product Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Product Details": {
      "main": [
        [
          {
            "node": "Generate Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Review": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format for WordPress": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Fetch Amazon Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        []
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Format for WordPress",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "versionId": "89574613-75ee-46bf-a0b0-d8033d0862c3",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "40370837ea0d6bd27e963794c3d315835e570360f4de2cbece02ecc284813c3f"
  },
  "id": "YpU9O70XhmVpVLZK",
  "tags": []
}```

just try drag and drop input to the http header if it doesn’t work may cause it’s not json response so try just write the value with out the the json and the bracket part

Thanks, yeah I tried that several times between switching from static to dynamic, but that doesn’t work (and results in “undefined”), like in the 3rd screenshot. Appreciate it.