GraphQL HTTP POST-Request Error; "Problems parsing JSON" #24480
-
Hello, I am having some trouble parsing JSON data in the GitHub GraphQL API. I am unsure if I am not writing the JSON in the correct format, or there’s another problem stemming from it. Below are photos of my command-prompt and my Visual Studio Code window: I appreciate any help that I can get for this error; have been very busy recently and am now able to write a post about this ongoing issue. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
It looks like you forgot the word
I hope that helps! |
Beta Was this translation helpful? Give feedback.
-
I have tried adding query like your example shows but that method still results in the same parsing error. Any other ideas? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Have you tried putting the query into the Explorer tool in our developer site to see what error message it shows? |
Beta Was this translation helpful? Give feedback.
-
Yep, tried the Explorer before writing the code just to make sure the query worked properly. Not sure what could be causing this error to occur. |
Beta Was this translation helpful? Give feedback.
-
Ok, so then it isn’t the query text itself but the method of calling the endpoint that is the problem. The only guess I have there is that you seem to be using the JavaScript request library and the documentation seems to indicate that the |
Beta Was this translation helpful? Give feedback.
-
Thank you, this did fix my problem. Alongside that, I also made sure to set the |
Beta Was this translation helpful? Give feedback.
Ok, so then it isn’t the query text itself but the method of calling the endpoint that is the problem. The only guess I have there is that you seem to be using the JavaScript request library and the documentation seems to indicate that the
form
parameter of thepost
method adds the data you supply as querystring parameters, rather than adding the text to the body. Try supplying the query contents to thebody
parameter of thepost
method instead.