Architecte JSON - Génère dynamiquement le format de sortie JSON pour n'importe quel agent IA

Avancé

Ceci est unEngineering, Multimodal AIworkflow d'automatisation du domainecontenant 34 nœuds.Utilise principalement des nœuds comme If, Set, StopAndError, ManualTrigger, SplitInBatches. Générer un format de sortie JSON dynamique pour les agents IA avec Mistral

Prérequis
  • Aucun prérequis spécial, prêt à l'emploi après importation
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "ITJwpEvX9Zijl4Xe",
  "meta": {
    "instanceId": "c8661626eeda758e004fa6cdc30e89de83810c1ff0923b0bb91a200abd0100f3",
    "templateCredsSetupCompleted": true
  },
  "name": "JSON Architect - Dynamically Generate JSON Output Formats for Any AI Agent",
  "tags": [
    {
      "id": "JK3I68rY6cIlUP5Z",
      "name": "V1.0",
      "createdAt": "2025-06-20T18:01:10.400Z",
      "updatedAt": "2025-06-20T18:01:10.400Z"
    },
    {
      "id": "in8l539iu2Ha3BD8",
      "name": "JSON Architect",
      "createdAt": "2025-07-07T01:55:29.343Z",
      "updatedAt": "2025-07-08T22:56:33.698Z"
    },
    {
      "id": "nEQ2nHALSQN4jgJ0",
      "name": "Free",
      "createdAt": "2025-06-25T21:55:38.353Z",
      "updatedAt": "2025-06-25T21:55:38.353Z"
    }
  ],
  "nodes": [
    {
      "id": "d8b4728f-23bb-42cf-aff4-128e61d141ad",
      "name": "Mistral Cloud Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "position": [
        1020,
        80
      ],
      "parameters": {
        "model": "mistral-small-latest",
        "options": {
          "safeMode": true,
          "maxRetries": 2
        }
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "i9fED0hhcQnPZBi6",
          "name": "Blank Account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "66103c5a-f12d-4505-a1b5-2e294bb3f827",
      "name": "JSON Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1020,
        -140
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"data\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"json_format_name\": {\n          \"type\": \"string\",\n          \"description\": \"A proper identification for this JSON format structure. Use snake_case.\"\n        },\n        \"json_format_usage\": {\n          \"type\": \"string\",\n          \"description\": \"How are subsequent AI Agents supposed to use the information in the JSON and its parameters.\"\n        },\n        \"json_format_structure\": {\n          \"type\": \"object\",\n          \"description\": \"The expected JSON object format for the necessary use-case.\"\n        }\n      },\n      \"required\": [\"json_format_name\", \"json_format_usage\", \"json_format_structure\"],\n      \"additionalProperties\": false\n  }\n  },\n  \"required\": [\"data\"],\n  \"additionalProperties\": false\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "608baf6f-daa5-4f8c-8edb-643decee6197",
      "name": "JSON Generator",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "maxTries": 2,
      "position": [
        740,
        -280
      ],
      "parameters": {
        "text": "={{ $json.input }}\n\n-----\n\nLast JSON Format Attempt (If it Already Exists): \n\"\"\"\n{{ $json.last_json_format_attempt }}\n\"\"\"\n\nCorrection Needed (In The Last JSON Format Attempt):\n\"\"\"\n{{ $json.correction_required }}\n\"\"\"",
        "options": {
          "systemMessage": "=You are a senior data engineer, tasked with creating the best possible JSON structure for the use-case informed in the prompt. Do not let any relevant information out of the JSON Structure. Here is an example of what is expected:\n\n\"\"\"\n{\n  \"type\": \"object\",\n  \"properties\": {\n    \"data\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"property_name_1\": {\n          \"type\": \"string\",\n          \"description\": \"...\"\n        },\n        \"property_name_2\": {\n          \"type\": \"object\",\n          \"description\": \"...\"\n        },\n        ...,\n        \"property_name_N\": {\n          \"type\": \"array\",\n          \"description\": \"...\"\n        }\n      },\n      \"required\": [\"property_name_1\", \"property_name_2\", ..., \"property_name_N\"],\n      \"additionalProperties\": false\n  }\n  },\n  \"required\": [\"data\"],\n  \"additionalProperties\": false\n}\n\"\"\"\n\nRemember to consider the possibility of a property nesting other structures inside it:  in that case the pattern provided above will repeat itself.\nRemember to be succint with your proposed JSON structure. Avoid pointless redundancy, unnecessary repetitions as much as possible."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 1.6,
      "waitBetweenTries": 3000
    },
    {
      "id": "53456018-4071-4442-a132-83eb1fad40f7",
      "name": "JSON Validator",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "maxTries": 2,
      "position": [
        1240,
        -280
      ],
      "parameters": {
        "text": "=JSON Format Name:\n{{ $json.output.data.json_format_name }}\n\nContext:\n{{ $json.output.data.json_format_usage }}\n\nInput used to generate the JSON:\n{{ $('Loop Until it Works').item.json.input }}\n\nJSON Format Structure:\n\"\"\"\n{{ $json.output.data.json_format_structure.toJsonString() }}\n\"\"\"\n",
        "options": {
          "systemMessage": "=You are an expert Data Analyst. Your ability to understand and validate data structures is unmatched.\nYou are tasked with reading a JSON format generated for an specific purpose.\nYou will assure the JSON is following the best practices.\nIf it isn't, then you must mark it as an invalid JSON.\n\nFor a JSON format to be considered valid, just having a proper structure isn't enough. The context must align with the JSON format itself."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 1.6,
      "waitBetweenTries": 3000
    },
    {
      "id": "5eaac98d-84b9-4e03-8ea0-980a375f4cae",
      "name": "JSON Output Parser 2",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1400,
        -20
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"data\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"json_format_valid\": {\n          \"type\": \"boolean\",\n          \"description\": \"The AI Agent's final veridict over the received JSON's format. It will be 'true' if it is a valid format, otherwise it will be 'false'.\"\n        },\n        \"json_format_valid_reason\": {\n          \"type\": \"string\",\n          \"description\": \"The AI Agent's reason for its veridict.\"\n        }\n      },\n      \"required\": [\"json_format_valid\", \"json_format_valid_reason\"],\n      \"additionalProperties\": false\n  }\n  },\n  \"required\": [\"data\"],\n  \"additionalProperties\": false\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "8f1dbe6a-d35e-43bd-b5d1-6553f223bf89",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -500,
        -140
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "426b7257-a0b3-4ce3-a8f9-c02222d5582f",
      "name": "Prepare Input",
      "type": "n8n-nodes-base.set",
      "position": [
        -240,
        -140
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0bebc801-88ee-48b6-9fdf-26124a3d2712",
              "name": "input",
              "type": "string",
              "value": "=A scenario where two characters are speaking with each other. It is during the night. They are talking about their respective magical powers: the ability to see the future and the ability to use alchemy."
            },
            {
              "id": "a7b62d3e-7171-4fb6-a6d0-7cffb33b21b9",
              "name": "correction_required",
              "type": "string",
              "value": ""
            },
            {
              "id": "39435221-2a3c-4b50-be83-a6035cca75b4",
              "name": "last_json_format_attempt",
              "type": "string",
              "value": ""
            },
            {
              "id": "cfff3d04-a827-4a50-8d61-04778b75dc7d",
              "name": "max_rounds",
              "type": "number",
              "value": 10
            },
            {
              "id": "d2e8c5ce-7242-4596-92cc-5dc76befe6ab",
              "name": "rounds",
              "type": "number",
              "value": 0
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "f9de1d71-8da8-4a5a-a8d3-9aad4f0b6821",
      "name": "Loop Until it Works",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        420,
        -80
      ],
      "parameters": {
        "options": {
          "reset": true
        }
      },
      "typeVersion": 3
    },
    {
      "id": "733867ee-9d1a-4cca-a82f-51d87ee53b35",
      "name": "Update Input",
      "type": "n8n-nodes-base.set",
      "position": [
        1820,
        280
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0bebc801-88ee-48b6-9fdf-26124a3d2712",
              "name": "input",
              "type": "string",
              "value": "={{ $('Loop Until it Works').item.json.input }}"
            },
            {
              "id": "a7b62d3e-7171-4fb6-a6d0-7cffb33b21b9",
              "name": "correction_required",
              "type": "string",
              "value": "={{ $json.output.data.json_format_valid_reason }}"
            },
            {
              "id": "39435221-2a3c-4b50-be83-a6035cca75b4",
              "name": "last_json_format_attempt",
              "type": "string",
              "value": "={{ $('JSON Generator').item.json.output.data.json_format_structure.toJsonString() }}"
            },
            {
              "id": "9f360b45-e90f-46e7-99aa-f7997bdab87e",
              "name": "rounds",
              "type": "number",
              "value": "={{ $('Guarantee Input').item.json.rounds + 1}}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "397a0c82-fab4-43c4-bbc6-7716cc087738",
      "name": "If Valid JSON",
      "type": "n8n-nodes-base.if",
      "position": [
        1580,
        -100
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4f15c457-d790-468f-9468-177378348593",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.output.data.json_format_valid }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "60d59670-4f1e-43a4-ab88-80db611fd810",
      "name": "JSON Reviewer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "onError": "continueErrorOutput",
      "maxTries": 3,
      "position": [
        1900,
        -240
      ],
      "parameters": {
        "text": "=Input to fit in the JSON:\n{{ $('Guarantee Input').item.json.input }}",
        "agent": "conversationalAgent",
        "options": {
          "systemMessage": "You are an expert Data Scientist. Your ability to work with data structures is unmatched.\nYou are tasked with testing the performance a JSON format generated for an specific purpose.\nYou will assure the JSON is working for its purpose by trying to fit in the input as best as you can in the JSON.\nIf you cannot do it, then it is an invalid JSON and the informed JSON structure should be ignored.\n\nFor a JSON format to be used in a valid manner, just having a proper structure isn't enough. The context must functionally work with the JSON format itself.\nIf the JSON is valid, then you must structure the input using the JSON.\n\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 1.6,
      "waitBetweenTries": 3000
    },
    {
      "id": "051fa8d6-aef4-49c9-8e3b-55f2781bba53",
      "name": "Guarantee Input",
      "type": "n8n-nodes-base.set",
      "position": [
        20,
        -100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0ac8a4d1-15e0-4e32-84a4-66776d35eff9",
              "name": "input",
              "type": "string",
              "value": "={{ $json.input }}"
            },
            {
              "id": "fabe83a4-0ad5-477a-a91d-dc88987e510b",
              "name": "correction_required",
              "type": "string",
              "value": "={{ $json.correction_required }}"
            },
            {
              "id": "4aef78c1-b422-40cc-8e38-505cd55eac2e",
              "name": "last_json_format_attempt",
              "type": "string",
              "value": "={{ $json.last_json_format_attempt }}"
            },
            {
              "id": "a015a41b-7ed2-4259-bcdc-28120b7111e4",
              "name": "rounds",
              "type": "number",
              "value": "={{ $json.rounds }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b202d5ce-5386-42ce-8825-5562a56fff55",
      "name": "Mistral Cloud Chat Model 2",
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "position": [
        1900,
        -20
      ],
      "parameters": {
        "model": "mistral-small-latest",
        "options": {
          "safeMode": true,
          "maxRetries": 2
        }
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "i9fED0hhcQnPZBi6",
          "name": "Blank Account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d013093a-da21-433c-8a27-57cca6a4439e",
      "name": "Advanced JSON Output Parser",
      "type": "n8n-nodes-advanced-output-parser.advancedOutputParser",
      "position": [
        2060,
        -20
      ],
      "parameters": {
        "jsonSchema": "={{ $('JSON Generator').item.json.output.data.json_format_structure.toJsonString() }}",
        "schemaMode": "dynamic"
      },
      "typeVersion": 1
    },
    {
      "id": "cce477a7-a9d6-4427-abbd-39812c18dbfa",
      "name": "Update Input 2",
      "type": "n8n-nodes-base.set",
      "position": [
        2280,
        340
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0bebc801-88ee-48b6-9fdf-26124a3d2712",
              "name": "input",
              "type": "string",
              "value": "={{ $('Loop Until it Works').item.json.input }}"
            },
            {
              "id": "a7b62d3e-7171-4fb6-a6d0-7cffb33b21b9",
              "name": "correction_required",
              "type": "string",
              "value": "={{ $json.error }}"
            },
            {
              "id": "39435221-2a3c-4b50-be83-a6035cca75b4",
              "name": "last_json_format_attempt",
              "type": "string",
              "value": "={{ $('JSON Generator').item.json.output.data.json_format_structure.toJsonString() }}"
            },
            {
              "id": "42881de4-54be-4647-8500-7b6d0ef11006",
              "name": "rounds",
              "type": "number",
              "value": "={{ $('Guarantee Input').item.json.rounds + 1}}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "c744a93e-2f1c-4695-85e5-e33bf7bd133c",
      "name": "JSON Format Works!",
      "type": "n8n-nodes-base.noOp",
      "position": [
        2600,
        -260
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d252e5ee-a4f0-488c-9af7-fd72941425fa",
      "name": "Prepare Output",
      "type": "n8n-nodes-base.set",
      "notes": "Adding a time string in the json_format_name for the sake of uniqueness.",
      "position": [
        2820,
        -260
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9eb037d0-83be-417c-8dcf-346860d9fdff",
              "name": "input",
              "type": "string",
              "value": "={{ $('Guarantee Input').item.json.input }}"
            },
            {
              "id": "0db22777-79cf-4cc8-acf4-0c548c7b9070",
              "name": "json_format_name",
              "type": "string",
              "value": "={{ $('JSON Generator').item.json.output.data.json_format_name }}_{{ $now.format('yyyy-MM-dd_HH_mm_ss') }}"
            },
            {
              "id": "853f31e7-fede-474f-a077-e30cd6ab1629",
              "name": "json_format_usage",
              "type": "string",
              "value": "={{ $('JSON Generator').item.json.output.data.json_format_usage }}"
            },
            {
              "id": "1177b5ee-b661-49dd-8d53-acc21c349715",
              "name": "json_format_valid_reason",
              "type": "string",
              "value": "={{ $('If Valid JSON').item.json.output.data.json_format_valid_reason }}"
            },
            {
              "id": "a870a989-2485-48c9-a248-f2da1ba16643",
              "name": "json_format_structure",
              "type": "object",
              "value": "={{ $('JSON Generator').item.json.output.data.json_format_structure }}"
            },
            {
              "id": "552aea6f-da3e-4a0a-b97a-14323751a6df",
              "name": "json_format_input",
              "type": "object",
              "value": "={{ $('JSON Reviewer').item.json.output.conversation }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "2be9cb84-bc58-4d3d-8768-7bd2cf4d6e10",
      "name": "If No More Rounds",
      "type": "n8n-nodes-base.if",
      "position": [
        200,
        -100
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e5534ac9-e0b4-473f-9525-bd9ede7b6128",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.rounds }}",
              "rightValue": "={{ $('Prepare Input').item.json.max_rounds }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "2f70e3b8-18b3-47cb-9edd-de4bb3c327ac",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1440,
        -600
      ],
      "parameters": {
        "color": 7,
        "width": 840,
        "height": 820,
        "content": "## JSON Architect - Dynamically Generate JSON Output Formats for Any AI Agent\n\n\n\n**Version** : 1.0\n**Creator** : Hybroht\n**Website** : hybroht.com\n\n\n\n\n\n**Description**: This workflow will instruct AI agents on what kind of JSON is needed in a given context and create the appropriate JSON structure. The JSON Architect will:\n- Generate the JSON format.\n- Generate a description of how it can be used by another AI agent.\n- Validate the generated JSON format.\n- If valid, it will be tested. It will be released as output if it passes the test.\n- If invalid or if it doesn't pass the test, it will try again until the generation works or the defined maximum number of rounds is exceeded.\n\n\n**How it Works**: You can configure it to initiate a set number of AI agents that will generate, validate, and test the JSON output format to be used by other AI agents. This is very useful as a sub-workflow.\n\n**Use-Cases**:\n- Procedural Generation\n- Data Interchange Formats\n- Machine Learning Model Input/Output\n- Configuration Management\n\n\n**Requirements**:\n- **This Workflow uses an important custom node for dynamically inputting JSON output format called \"n8n-nodes-advanced-output-parser\"**.\nYou can find the link to the repository here:\nhttps://github.com/volkovmqx/n8n-nodes-advanced-output-parser\n\n*Warning: as of 2025-07-08, the custom node creator has warned that this node is not production-ready. Beware when using it in production environments without being aware of its readiness.*\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b4a5da69-fb3e-4db6-b41a-cae237c1523c",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -780,
        -520
      ],
      "parameters": {
        "color": 7,
        "width": 150,
        "content": "![Hybroht](https://hybroht.com/assets/favicon.png \"Hybroht Logo\")"
      },
      "typeVersion": 1
    },
    {
      "id": "06e1b233-f22c-4219-8367-24c18921404b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -680
      ],
      "parameters": {
        "width": 2560,
        "height": 1240,
        "content": "# JSON Construction\n\n**Round Start** will initiate the round of JSON construction.\n**JSON Generation & Validation** will generate and validate the JSON according to the input from the start of the round.\n**JSON Test** will verify whether the generated JSON format actually works.\n**Validation or Test fails** will occur when the generated JSON fails either the validation or the test during the workflow. In that case, it will be sent back to **Round Start**"
      },
      "typeVersion": 1
    },
    {
      "id": "4a528b75-cf8e-4534-8bc4-7f875047bd03",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        660,
        -500
      ],
      "parameters": {
        "color": 5,
        "width": 1080,
        "height": 720,
        "content": "## JSON Generation & Validation \n**JSON Generator** will attempt to create an appropriate JSON format for the input, preserving as much of its information as possible.\n**JSON Validator** will check if the generated JSON format makes sense. It will not test whether it works, but will check the structure to determine if it is appropriate for the input. It will return a boolean representing the validity of the JSON format and a reason for its approval or rejection.\n**If Valid JSON** will receive the response from the JSON Validator. If the JSON Validator does not approve the generated JSON format, it will send it back for a new round along with its latest iteration and the reason for the rejection."
      },
      "typeVersion": 1
    },
    {
      "id": "110676e0-1bcd-431b-bb3b-b62709e675a9",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1800,
        -400
      ],
      "parameters": {
        "color": 5,
        "width": 660,
        "height": 560,
        "content": "## JSON Test\n**JSON Reviewer** will test the generated JSON format. If the test fails, the latest iteration of the JSON format will be sent back for a new round along with the error that occurred.\n**Advanced JSON Output Parser** will dynamically receive the JSON format and apply it to the output. *This is a required custom node because the standard JSON Output Parser cannot accept expressions.*"
      },
      "typeVersion": 1
    },
    {
      "id": "80045779-5409-4662-8b89-1a142e750f7a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        660,
        240
      ],
      "parameters": {
        "color": 2,
        "width": 1800,
        "height": 300,
        "content": "## Validation or Test fails\n\n- If the **JSON Validator** rejects the generated JSON or if it fails the test conducted by the JSON Reviewer, it will be sent back to the beginning.\n- The loop will restart with updated information regarding what went wrong in the last round, along with the latest iteration of the JSON format that requires fixing."
      },
      "typeVersion": 1
    },
    {
      "id": "8815f509-8644-4a1b-991e-6213efa58d26",
      "name": "Round Limit Reached",
      "type": "n8n-nodes-base.stopAndError",
      "position": [
        420,
        -280
      ],
      "parameters": {
        "errorMessage": "Round Limit Reached!"
      },
      "typeVersion": 1
    },
    {
      "id": "ade7be68-4ad1-4884-b38a-2abdf52c80fe",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -400
      ],
      "parameters": {
        "color": 5,
        "width": 680,
        "height": 560,
        "content": "## Round Start\n**Guarantee Input** will ensure that the input going into the loop is as expected.\n**If No More Rounds** will check the number of rounds passed to see if it has reached the limit.\n**Loop Until It Works** will execute the workflow until it is interrupted by an If Condition."
      },
      "typeVersion": 1
    },
    {
      "id": "240025e4-8d07-406f-bb96-c1ec875d8c23",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2540,
        -440
      ],
      "parameters": {
        "color": 6,
        "width": 580,
        "height": 820,
        "content": "## JSON Architect Results\n**Prepare Output** will capture the results of the JSON Architect and prepare them to be released as an output."
      },
      "typeVersion": 1
    },
    {
      "id": "b3659bca-2065-4b12-b065-4e02a63bc626",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -400
      ],
      "parameters": {
        "color": 4,
        "width": 480,
        "height": 720,
        "content": "## Setup and Start\n**Prepare Input** will simulate the acquisition of the expected data for better compatibility with eventually turning this workflow into a sub-workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "992d3320-5cfd-4a61-8924-75461afb6778",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -680
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 260,
        "content": "### Information - n8n setup\n- n8n Version\n1.100.1\n\n- n8n-nodes-advanced-output-parser\n1.0.1\n\n- Running n8n via:\nPodman 4.3.1\n\n- Operating system:\nLinux"
      },
      "typeVersion": 1
    },
    {
      "id": "0fa743a0-19f7-4999-b023-85bee0edc506",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        60
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 220,
        "content": "**Expected Input**:\n\n- **input** : The input that requires a proper JSON structure.\n- **max_rounds** : The maximum number of rounds before stopping the loop if it fails to produce and test a valid JSON structure for the input.\n- **rounds** : The initial number of rounds. Default: 0."
      },
      "typeVersion": 1
    },
    {
      "id": "4abd3949-dec0-4292-a6fd-5b4d815f9896",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2580,
        -60
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 360,
        "content": "**Expected Output**:\n\n- **input** : The original input used to create the JSON structure.\n- **json_format_name** : A snake_case identifier for the generated JSON format, created by the AI agents based on the nature of the JSON format itself.\n- **json_format_usage** : A description of how to use the JSON format in an input.\n- **json_format_valid_reason** : The reason provided by the AI agents to explain why this JSON format works for the input it is based on.\n- **json_format_structure** : The JSON format itself, intended to be applied to AI agents through the **Advanced JSON Output Parser** custom node.\n- **json_format_input** : The input after the JSON format has been applied to it."
      },
      "typeVersion": 1
    },
    {
      "id": "33a162fa-5031-4443-814b-12e120ea3787",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        100,
        200
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 220,
        "content": "**Round Args**:\n\n- **correction_required** : If a round fails, the AI agents will indicate why it failed. This information will be provided to the JSON Generator in the next round in an attempt to fix the problem.\n- **last_json_format_attempt** : The latest iteration of the JSON format that requires fixing in the event of a round failure."
      },
      "typeVersion": 1
    },
    {
      "id": "47f5a6d6-7405-49e2-89a2-91d62518b56b",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1420,
        340
      ],
      "parameters": {
        "color": 3,
        "width": 1340,
        "height": 1980,
        "content": "### Input & Output Example\n\n\n---\n\n**Input**: \"A scenario where two characters are speaking with each other. It is during the night. They are talking about their respective magical powers: the ability to see the future and the ability to use alchemy.\"\n\n\n---\n**Output**\n\n- **json_format_name** : magical_conversation_nighttime_2025-07-09_10_42_54\n\n- **json_format_usage** : This JSON structure is designed to capture a conversation between two characters during the night, focusing on their magical abilities, specifically the ability to see the future and the ability to use alchemy.\n\n- **json_format_valid_reason** : The JSON structure aligns perfectly with the context provided. It captures a conversation during the night between two characters discussing their magical abilities, specifically the ability to see the future and the ability to use alchemy. The structure includes the time, location, characters with their magical abilities, and the dialogue, all of which are relevant to the context of a nighttime conversation about magical powers.\n\n- **json_format_structure** : See to the right. --->\n\n- **json_format_input**: {\n  \"time\": \"night\",\n  \"location\": \"unknown\",\n  \"characters\": [\n\t{\n\t  \"name\": \"Character A\",\n\t  \"magical_abilities\": [\n\t\t{\n\t\t  \"ability_name\": \"See the Future\",\n\t\t  \"description\": \"The ability to see events that have not yet occurred\"\n\t\t}\n\t  ]\n\t},\n\t{\n\t  \"name\": \"Character B\",\n\t  \"magical_abilities\": [\n\t\t{\n\t\t  \"ability_name\": \"Alchemy\",\n\t\t  \"description\": \"The ability to transform matter and create potions with magical properties\"\n\t\t}\n\t  ]\n\t}\n  ],\n  \"dialogue\": [\n\t{\n\t  \"speaker\": \"Character A\",\n\t  \"text\": \"I have the ability to see the future, it's quite fascinating.\"\n\t},\n\t{\n\t  \"speaker\": \"Character B\",\n\t  \"text\": \"That's impressive. I, on the other hand, practice alchemy. It's a powerful art.\"\n\t}\n  ]\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "fa3c77db-ff57-435b-94fc-8ac91011a249",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        700
      ],
      "parameters": {
        "color": 3,
        "width": 1000,
        "height": 1620,
        "content": "- **json_format_structure** : \n{\n  \"type\": \"object\",\n  \"properties\": {\n\t\"conversation\": {\n\t  \"type\": \"object\",\n\t  \"properties\": {\n\t\t\"time\": {\n\t\t  \"type\": \"string\",\n\t\t  \"description\": \"The time of the conversation, indicating it is during the night.\"\n\t\t},\n\t\t\"location\": {\n\t\t  \"type\": \"string\",\n\t\t  \"description\": \"The location where the conversation is taking place.\"\n\t\t},\n\t\t\"characters\": {\n\t\t  \"type\": \"array\",\n\t\t  \"items\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"properties\": {\n\t\t\t  \"name\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t\t\"description\": \"The name of the character.\"\n\t\t\t  },\n\t\t\t  \"magical_abilities\": {\n\t\t\t\t\"type\": \"array\",\n\t\t\t\t\"items\": {\n\t\t\t\t  \"type\": \"object\",\n\t\t\t\t  \"properties\": {\n\t\t\t\t\t\"ability_name\": {\n\t\t\t\t\t  \"type\": \"string\",\n\t\t\t\t\t  \"description\": \"The name of the magical ability.\"\n\t\t\t\t\t},\n\t\t\t\t\t\"description\": {\n\t\t\t\t\t  \"type\": \"string\",\n\t\t\t\t\t  \"description\": \"A description of the magical ability.\"\n\t\t\t\t\t}\n\t\t\t\t  },\n\t\t\t\t  \"required\": [\n\t\t\t\t\t\"ability_name\",\n\t\t\t\t\t\"description\"\n\t\t\t\t  ],\n\t\t\t\t  \"additionalProperties\": false\n\t\t\t\t}\n\t\t\t  }\n\t\t\t},\n\t\t\t\"required\": [\n\t\t\t  \"name\",\n\t\t\t  \"magical_abilities\"\n\t\t\t],\n\t\t\t\"additionalProperties\": false\n\t\t  }\n\t\t},\n\t\t\"dialogue\": {\n\t\t  \"type\": \"array\",\n\t\t  \"items\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"properties\": {\n\t\t\t  \"speaker\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t\t\"description\": \"The name of the character speaking.\"\n\t\t\t  },\n\t\t\t  \"text\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t\t\"description\": \"The text spoken by the character.\"\n\t\t\t  }\n\t\t\t},\n\t\t\t\"required\": [\n\t\t\t  \"speaker\",\n\t\t\t  \"text\"\n\t\t\t],\n\t\t\t\"additionalProperties\": false\n\t\t  }\n\t\t}\n\t  },\n\t  \"required\": [\n\t\t\"time\",\n\t\t\"location\",\n\t\t\"characters\",\n\t\t\"dialogue\"\n\t  ],\n\t  \"additionalProperties\": false\n\t}\n  },\n  \"required\": [\n\t\"conversation\"\n  ],\n  \"additionalProperties\": false\n}"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e6abb899-a1db-43cc-8548-45c5848bc4f4",
  "connections": {
    "733867ee-9d1a-4cca-a82f-51d87ee53b35": {
      "main": [
        [
          {
            "node": "051fa8d6-aef4-49c9-8e3b-55f2781bba53",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "397a0c82-fab4-43c4-bbc6-7716cc087738": {
      "main": [
        [
          {
            "node": "60d59670-4f1e-43a4-ab88-80db611fd810",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "733867ee-9d1a-4cca-a82f-51d87ee53b35",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "60d59670-4f1e-43a4-ab88-80db611fd810": {
      "main": [
        [
          {
            "node": "c744a93e-2f1c-4695-85e5-e33bf7bd133c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "cce477a7-a9d6-4427-abbd-39812c18dbfa",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "426b7257-a0b3-4ce3-a8f9-c02222d5582f": {
      "main": [
        [
          {
            "node": "051fa8d6-aef4-49c9-8e3b-55f2781bba53",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "608baf6f-daa5-4f8c-8edb-643decee6197": {
      "main": [
        [
          {
            "node": "53456018-4071-4442-a132-83eb1fad40f7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "53456018-4071-4442-a132-83eb1fad40f7": {
      "main": [
        [
          {
            "node": "397a0c82-fab4-43c4-bbc6-7716cc087738",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cce477a7-a9d6-4427-abbd-39812c18dbfa": {
      "main": [
        [
          {
            "node": "051fa8d6-aef4-49c9-8e3b-55f2781bba53",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "051fa8d6-aef4-49c9-8e3b-55f2781bba53": {
      "main": [
        [
          {
            "node": "2be9cb84-bc58-4d3d-8768-7bd2cf4d6e10",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2be9cb84-bc58-4d3d-8768-7bd2cf4d6e10": {
      "main": [
        [
          {
            "node": "8815f509-8644-4a1b-991e-6213efa58d26",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "f9de1d71-8da8-4a5a-a8d3-9aad4f0b6821",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c744a93e-2f1c-4695-85e5-e33bf7bd133c": {
      "main": [
        [
          {
            "node": "d252e5ee-a4f0-488c-9af7-fd72941425fa",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "66103c5a-f12d-4505-a1b5-2e294bb3f827": {
      "ai_outputParser": [
        [
          {
            "node": "608baf6f-daa5-4f8c-8edb-643decee6197",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "f9de1d71-8da8-4a5a-a8d3-9aad4f0b6821": {
      "main": [
        [],
        [
          {
            "node": "608baf6f-daa5-4f8c-8edb-643decee6197",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5eaac98d-84b9-4e03-8ea0-980a375f4cae": {
      "ai_outputParser": [
        [
          {
            "node": "53456018-4071-4442-a132-83eb1fad40f7",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "d8b4728f-23bb-42cf-aff4-128e61d141ad": {
      "ai_languageModel": [
        [
          {
            "node": "608baf6f-daa5-4f8c-8edb-643decee6197",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "53456018-4071-4442-a132-83eb1fad40f7",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "b202d5ce-5386-42ce-8825-5562a56fff55": {
      "ai_languageModel": [
        [
          {
            "node": "60d59670-4f1e-43a4-ab88-80db611fd810",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "d013093a-da21-433c-8a27-57cca6a4439e": {
      "ai_outputParser": [
        [
          {
            "node": "60d59670-4f1e-43a4-ab88-80db611fd810",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "8f1dbe6a-d35e-43bd-b5d1-6553f223bf89": {
      "main": [
        [
          {
            "node": "426b7257-a0b3-4ce3-a8f9-c02222d5582f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Ingénierie, IA Multimodale

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds34
Catégorie2
Types de nœuds11
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur
Hybroht

Hybroht

@hybroht

Company dedicated to delivering tailored software solutions and data-driven experiences through effective technology. We develop workflows leveraging AI agents to maximize the productive benefits of artificial intelligence.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34