jsonecho

GraphQL Formatter

Format GraphQL queries and schemas so nested selections are easy to read.

Loading the tool...

How to use GraphQL Formatter

  1. Paste your code. The formatter engine loads in a moment the first time.
  2. Adjust the options if you need to.
  3. Copy the formatted result.

About GraphQL Formatter

GraphQL queries grow fast. A query with a few nested selections already spans a dozen lines, and when it is copied from a network log it arrives on one. This formatter puts each field on its own line and indents selections under their parent.

It handles queries, mutations, subscriptions, fragments and schema definitions (SDL). Comments are kept.

Frequently asked questions

Does it validate against a schema?

No. It checks the syntax of the query and tells you where it breaks, but cannot know your schema.

Can it format a schema file?

Yes, type definitions, enums, interfaces and directives are all supported.

Does the formatter reorder fields?

No. Fields stay in the order you wrote them.

Why did the first run take a second?

The formatting engine for this language is downloaded the first time you use it, then cached by your browser. After that, formatting is instant and nothing leaves your machine.

More in Code Formatters

All tools →