mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 21:37:32 -08:00
⚡ Automatically parse response in GraphQL node to JSON
This commit is contained in:
parent
8acc3c5931
commit
108ffb0d86
|
@ -221,12 +221,16 @@ export class GraphQL implements INodeType {
|
|||
});
|
||||
} else {
|
||||
if (typeof response === '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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.prepareOutputData(returnItems);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue