# graphql-js-tree

> GraphQL Parser providing simplier structure

Latest version **3.0.4** (published 2025-09-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install graphql-js-tree
pnpm add graphql-js-tree
yarn add graphql-js-tree
bun add graphql-js-tree
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: declining downloads.

## Facts

| | |
|---|---|
| Version | 3.0.4 |
| Published | 2025-09-30 |
| First published | 2021-08-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 231.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Maintainers | slothking |

## Links

- npm: https://www.npmjs.com/package/graphql-js-tree
- Repository: https://github.com/graphql-editor/graphql-js-tree
- Homepage: https://graphqleditor.com
- Issues: https://github.com/graphql-editor/graphql-js-tree.git
- npm.io page: https://npm.io/package/graphql-js-tree

## Recent versions

- 3.0.4 (latest) — 2025-09-30
- 3.0.3 — 2025-08-26
- 3.0.2 — 2024-12-04
- 3.0.1 — 2024-07-17
- 3.0.0 — 2024-07-15
- 2.0.2 — 2024-06-06
- 2.0.1 — 2024-05-07
- 2.0.0 — 2024-04-05
- 1.0.9 — 2024-01-20
- 1.0.8 — 2024-01-20
- 1.0.7 — 2024-01-20
- 1.0.6 — 2023-09-29
- 1.0.5 — 2023-08-14
- 1.0.4 — 2023-08-14
- 1.0.3 — 2023-08-14
- … 36 more at https://npm.io/package/graphql-js-tree/versions

## README

![](images/zeus.gif)

[![npm](https://img.shields.io/npm/v/graphql-js-tree.svg?style=flat-square)](https://www.npmjs.com/package/graphql-js-tree) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/) [![npm downloads](https://img.shields.io/npm/dt/graphql-js-tree.svg?style=flat-square)](https://www.npmjs.com/package/graphql-js-tree)

Simplier approach to GraphQL parsing. Using graphql-js library and parsing AST to simplier types. It is a backbone of `graphql-zeus` and `graphql-editor`

## How it works

### SDL GraphQL

It creates very simple `ParserTree` from GraphQL schema

```js
import { Parser, TreeToGraphQL } from 'graphql-js-tree';

const schemaFileContents = `
type Query{
    hello: String!
}
schema{
    query: Query
}
`;

const parsedSchema = Parser.parse(schemaFileContents);

// Backwards

const graphqlString = TreeToGraphQL.parse(parsedSchema);
```

### GQL

```js
import { parseGql } from 'graphql-js-tree';

const schemaFileContents = `
type Query{
    hello: String!
}
schema{
    query: Query
}
`;

const gqlQuery = `
    query MyQuery{
        hello
    }
`;

const parsedTrees = parseGql(gqlQuery, schemaFileContents);

// Backwards

const gqlString = parseGqlTrees(parsedTrees);
```

## Table of contents

- [How it works](#how-it-works)
  - [SDL GraphQL](#sdl-graphql)
  - [GQL](#gql)
- [Table of contents](#table-of-contents)
- [License](#license)
- [Support](#support)
- [Contribute](#contribute)

## License

MIT

## Support

[Join our GraphQL Editor Channel](https://join.slack.com/t/graphqleditor/shared_invite/enQtNDkwOTgyOTM5OTc1LWI4YjU3N2U5NGVkNzQ2NzY5MGUxMTJiNjFlZDM1Zjc2OWRmNTI0NDM3OWUxYTk4Yjk3MzZlY2QwOWUzZmM2NDI)

Leave a star ;)

## Contribute

For a complete guide to contributing to GraphQL Editor, see the [Contribution Guide](CONTRIBUTING.md).

1.  Fork this repo
2.  Create your feature branch: git checkout -b feature-name
3.  Commit your changes: git commit -am 'Add some feature'
4.  Push to the branch: git push origin my-new-feature
5.  Submit a pull request

---
_Source: https://npm.io/package/graphql-js-tree · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
