Formats

GraphQL Formatter

Format and beautify GraphQL queries and mutations.

How to use it

  1. Open Devly from the wrench in your menu bar, or press ⌃⌥⌘D. Press ⌘P, type GraphQL Formatter and press Return.
  2. Paste or type your text into Input.
  3. Adjust the Options on the right if you need to. The defaults are listed below.
  4. Press Format, or ⌘↵.
  5. Use Copy or ⇧⌘C to copy the result. ⌘L clears everything.

Options

OptionValuesDefault
Indent SpacesNumber of spaces for indentation1–82
Sort fields alphabeticallySort fields within selectionsOn or offOff

Example

Real output from Devly, with the default options.

Input
query GetUser($id: ID!) { user(id: $id) { id name email posts(first: 5) { edges { node { id title } } } } }
query
GetUser($id: ID!) {
  user(id: $id) {
    id
    name
    email
    posts(first: 5) {
      edges {
        node {
          id
          title
        }
      }
    }
  }
}

From Terminal

With the free command-line tool installed:

Terminal
devly graphql --path input.txt
# or pipe text in
pbpaste | devly graphql

Quick Switch also finds it by: graphql, gql, format, query, mutation, api.

More Formats tools