convertCASEpro

MODE

GraphQL Formatter

Paste a GraphQL document and get it laid out cleanly.

INPUT
CHARS: 0WORDS: 0LINES: 0
OUTPUT
CHARS: 0WORDS: 0LINES: 0

How the GraphQL Formatter works

The formatter parses the document and prints it again with standard spacing: one field per line, arguments aligned, fragments and directives preserved and comments kept in place. Both executable documents (queries, mutations, subscriptions) and schema definitions (types, interfaces, enums) are supported.

Because it parses before printing, a syntax error such as an unclosed brace is reported with its location, which doubles as a quick validity check.

When it is useful

  • •Making a query copied from a network inspector readable.
  • •Standardizing schema files before committing them.
  • •Checking a hand written query for missing braces.
  • •Preparing queries for documentation or a pull request.

Frequently Asked Questions

Does it check my query against a schema?

No. It validates syntax only. It does not know your schema, so it cannot tell whether a field exists.

Are comments preserved?

Yes. Lines starting with a hash are kept where they are.

Can it format variables JSON as well?

Use the JSON Formatter for the variables object.

Related tools

[ Browse all tools ]