There is an online converter:
https://datafetcher.com/graphql-json-body-converter
But if use token address, you need add backslash before double quotes (tested in postman).
For example this is graphql query:
{
pairs(where: {token0: "0x1381f369d9d5df87a1a04ed856c9dbc90f5db2fa", token1: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}) {
token0 {
name
symbol
}
token0Price
token1 {
name
symbol
}
token1Price
}
}
And this is result of conversion to JSON from previous link:
{
"query": "{ pairs(where: {token0: "0x1381f369d9d5df87a1a04ed856c9dbc90f5db2fa", token1: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}) { token0 { name symbol } token0Price token1 { name symbol } token1Price }}"
}
Just add backslashes before double quotes near token addresses. Result:
{
"query": "{ pairs(where: {token0: \"0x1381f369d9d5df87a1a04ed856c9dbc90f5db2fa\", token1: \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"}) { token0 { name symbol } token0Price token1 { name symbol } token1Price }}"
}