If you're looking to convert JSON data online, check out this convenient converter:
When using token addresses, remember to add a backslash before double quotes (as tested in postman).
Here's an example of a graphql query:
{
pairs(where: {token0: "0x1381f369d9d5df87a1a04ed856c9dbc90f5db2fa", token1: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}) {
token0 {
name
symbol
}
token0Price
token1 {
name
symbol
}
token1Price
}
}
After converting the above query to JSON using the provided link, here is the result:
{
"query": "{ pairs(where: {token0: "0x1381f369d9d5df87a1a04ed856c9dbc90f5db2fa", token1: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}) { token0 { name symbol } token0Price token1 { name symbol } token1Price }}"
}
Remember to include backslashes before double quotes near token addresses for accuracy. Your final converted JSON should look like this:
{
"query": "{ pairs(where: {token0: \"0x1381f369d9d5df87a1a04ed856c9dbc90f5db2fa\", token1: \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"}) { token0 { name symbol } token0Price token1 { name symbol } token1Price }}"
}