{
  "name": "ezgpt-json-array-demo",
  "active": false,
  "nodes": [
    {
      "id": "617db2c8-be5c-4350-9e85-b97c4c77f017",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "e2a48042-1708-4727-88c3-a3159d00f412",
      "name": "Get Posts",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        260,
        0
      ],
      "parameters": {
        "url": "https://jsonplaceholder.typicode.com/posts",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "userId",
              "value": "1"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "json"
            }
          },
          "timeout": 15000
        }
      }
    },
    {
      "id": "26ff2a27-e9a5-42a5-8821-d4fd324e7982",
      "name": "Check List",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        520,
        0
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "b6d6525c-7933-454f-90f3-276af9eaeaef",
              "leftValue": "={{ $json.statusCode === 200 && Array.isArray($json.body) && $json.body.length > 0 && $json.body.length <= 10 && $json.body.every(p => p !== null && Number.isSafeInteger(p.id) && p.id > 0 && p.userId === 1 && typeof p.title === 'string' && p.title.trim().length > 0 && typeof p.body === 'string' && p.body.trim().length > 0) }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "5b4ac62b-3bd2-4c47-838c-823458d48b99",
      "name": "Split Posts",
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        780,
        -100
      ],
      "parameters": {
        "fieldToSplitOut": "body",
        "include": "noOtherFields",
        "options": {
          "destinationFieldName": "post"
        }
      }
    },
    {
      "id": "caa492a3-e6c3-494d-826f-74ef345c8e25",
      "name": "Build Rows",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1040,
        -100
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "600548e9-23c1-4f61-9462-eb89023e8d77",
              "name": "post_id",
              "type": "number",
              "value": "={{ $json.post.id }}"
            },
            {
              "id": "a4fa8928-0fa9-4220-b277-4ddd323bf236",
              "name": "user_id",
              "type": "number",
              "value": "={{ $json.post.userId }}"
            },
            {
              "id": "a35de6d1-323a-46d0-8fd1-3f39943768c4",
              "name": "title",
              "type": "string",
              "value": "={{ $json.post.title }}"
            },
            {
              "id": "b189947d-659e-4dbc-9b3e-d94f4a72502d",
              "name": "body_length",
              "type": "number",
              "value": "={{ $json.post.body.length }}"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      }
    },
    {
      "id": "e86e7d63-aad1-4e11-9266-4b91b28a0cce",
      "name": "Reject List",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        780,
        180
      ],
      "parameters": {
        "errorMessage": "Expected HTTP 200 and 1-10 posts for user 1 with numeric id and nonempty title/body"
      }
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Get Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Posts": {
      "main": [
        [
          {
            "node": "Check List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check List": {
      "main": [
        [
          {
            "node": "Split Posts",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Reject List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Posts": {
      "main": [
        [
          {
            "node": "Build Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
