Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In a GraphQL API, variables in a POST body should be input as an object. This is because it aligns with the syntax of GraphQL queries and allows for easier manipulation and validation of the input data on the server side. Using a JSON-encoded string with layers of recursion can make it difficult to parse and manipulate the input data, leading to potential errors and security vulnerabilities. Additionally, using an object as input allows for better type validation and easier error handling.