https://github.com/jonathas/format-graphql-payload
Reads an unformatted GraphQL payload and formats it
https://github.com/jonathas/format-graphql-payload
Last synced: 3 months ago
JSON representation
Reads an unformatted GraphQL payload and formats it
- Host: GitHub
- URL: https://github.com/jonathas/format-graphql-payload
- Owner: jonathas
- License: mit
- Created: 2023-02-21T16:06:02.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-02-21T16:07:42.000Z (over 3 years ago)
- Last Synced: 2025-03-06T12:16:37.176Z (over 1 year ago)
- Language: TypeScript
- Size: 134 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Format GraphQL Payload
If you're trying to copy a GraphQL query which got extracted from the Network panel in the browser in order to paste it into the GraphQL Playground so that you can debug it, that might get a bit complicated if the query is too big.
The query is stringified:

And if you click on "view source", that doesn't help much:

## Usage
- Install the dependencies
```
npm i
```
- Click on "view sorce" in the Network panel and copy the whole request payload for the GraphQL query
- Save it to a .txt file
- Run this script informing the input and output paths
```
npm start ./plain-text-payload.input.txt ./output.txt
```
- In the output file you'll see it formatted and ready to be used