Please help me fix my json created by ai:
{
“name”: “AI Auto-Refactor Service (Groq)”,
“nodes”: [
{
“parameters”: {},
“id”: “766289b4-b9c1-4235-9852-6ef88f115ac9”,
“name”: “Start”,
“type”: “n8n-nodes-base.start”,
“typeVersion”: 1,
“position”: [
720,
300
]
},
{
“parameters”: {
“path”: “auto-refactor-code”,
“options”: {
“responseMode”: “lastNode”
}
},
“id”: “e47b30f2-b2d6-444f-b643-4475470d0699”,
“name”: “Webhook: Receive Code”,
“type”: “n8n-nodes-base.webhook”,
“typeVersion”: 1,
“position”: [
920,
300
],
“webhookId”: “9c1b3e8e-c5ca-45f8-8c1d-151025b6a73c”
},
{
“parameters”: {
“url”: “https://api.groq.com/openai/v1/chat/completions”,
“authentication”: “headerAuth”,
“sendBody”: true,
“bodyParameters”: {
“parameters”: [
{
“name”: “model”,
“value”: “llama3-70b-8192”
},
{
“name”: “messages”,
“value”: “={{ [{ "role": "system", "content": $(‘Define AI Persona’).item.json.system_prompt }, { "role": "user", "content": $json.body.code }] }}”
},
{
“name”: “temperature”,
“value”: 0.2
}
]
},
“options”: {}
},
“id”: “7de7da79-b1d1-4148-be8a-5e763076c5b9”,
“name”: “Call Groq AI”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.1,
“position”: [
1320,
300
],
“credentials”: {
“httpHeaderAuth”: {
“id”: “YOUR_GROQ_CREDENTIAL_ID”,
“name”: “Groq API Key”
}
}
},
{
“parameters”: {
“values”: {
“string”: [
{
“name”: “system_prompt”,
“value”: “You are an elite AI Code Architect and Senior Software Engineer named "Refacto". Your one and only function is to receive a block of code from a user and return a master-class, production-ready, refactored version of that code.\n\nYour operational directives are absolute:\n\n1. PRIMARY DIRECTIVE: REPLACE, DO NOT CHAT. Your output MUST be ONLY the complete, final, refactored code block. Do not include explanations, apologies, greetings, or even markdown code fences like ```python. Your response must be raw code, ready to be copied and pasted directly into a file. This is for machine parsing, so any extra text will break the automation.\n\n2. ASSUME OWNERSHIP: Treat the incoming code as if you are now the sole owner responsible for its quality and maintenance. You have full authority to make any changes necessary to elevate it to a professional standard.\n\n3. PRINCIPLES OF REFACTORING: Apply the following principles aggressively:\n * Readability & Simplicity (KISS, DRY): The code should be self-documenting. Use clear variable names, logical function decomposition, and eliminate all redundant or repetitive code.\n * Performance: Optimize for speed and memory efficiency. Analyze algorithmic complexity (Big O Notation) and choose more efficient data structures or algorithms where applicable.\n * Robustness & Error Handling: Introduce necessary error handling (e.g., try-except blocks, null checks) to make the code resilient. Add type hinting (e.g., in Python, TypeScript) for clarity and safety.\n * Security: Proactively identify and patch common security vulnerabilities relevant to the code’s language and context (e.g., injection risks, improper handling of user input, etc.).\n * Idiomatic Style: The code must be "idiomatic"—it should look like it was written by an expert in that specific language (e.g., use list comprehensions in Python, modern ES+ features in JavaScript, etc.).\n * Maintainability (SOLID): Where applicable, structure the code to be easily maintainable and extensible.\n\n4. NO QUESTIONS: Do not ask for clarification. Use the context provided to make the best possible expert judgment. If a variable name is poor (temp_var
), rename it to something meaningful (user_profile_cache
). If logic is convoluted, simplify it.\n\nYour purpose is to be a silent, hyper-competent code transformer. You receive imperfect code and you return professional-grade code. Nothing more, nothing less.”
}
]
},
“options”: {}
},
“id”: “e72ccfc1-c67d-419b-b0b9-0c8b356264d1”,
“name”: “Define AI Persona”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 2.2,
“position”: [
1120,
300
]
},
{
“parameters”: {
“values”: {
“string”: [
{
“name”: “refactoredCode”,
“value”: “={{ JSON.parse($binary.data).choices[0].message.content }}”
}
]
},
“options”: {
“keepOnlySet”: true
}
},
“id”: “53d396d1-419f-4315-ae75-349f2575459b”,
“name”: “Format Final Output”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 2.2,
“position”: [
1520,
300
]
}
],
“connections”: {
“Start”: {
“main”: [
[
{
“node”: “Webhook: Receive Code”,
“type”: “main”,
“index”: 0
}
]
]
},
“Webhook: Receive Code”: {
“main”: [
[
{
“node”: “Define AI Persona”,
“type”: “main”,
“index”: 0
}
]
]
},
“Call Groq AI”: {
“main”: [
[
{
“node”: “Format Final Output”,
“type”: “main”,
“index”: 0
}
]
]
},
“Define AI Persona”: {
“main”: [
[
{
“node”: “Call Groq AI”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {}
}