mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
⚡ Automatically parse response in GraphQL node to JSON
This commit is contained in:
@@ -221,10 +221,14 @@ export class GraphQL implements INodeType {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (typeof response === 'string') {
|
if (typeof response === 'string') {
|
||||||
throw new Error('Response body is not valid JSON. Change "Response Format" to "String"');
|
try {
|
||||||
|
returnItems.push({ json: JSON.parse(response) });
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error('Response body is not valid JSON. Change "Response Format" to "String"');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
returnItems.push({ json: response });
|
||||||
}
|
}
|
||||||
|
|
||||||
returnItems.push({ json: response });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user