Created
May 23, 2017 09:48
-
-
Save MrCitron/bcbbd14bb988133fff6233c4d7e6109f to your computer and use it in GitHub Desktop.
GraphQL to JSON in pure JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function graphQLToJSON(query) { | |
return "{\"query\": \"query" + | |
query.replace(/\n/g, " ").replace(/"/g, "\\\"") + | |
"\"}"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment