1

how can I avoid the parsing errors for

curl -H 'Accept: application/vnd.github.VERSION.raw' -XPUT -g 'https://api.github.com/repos/USER/l1/contents/PATH/FILENAME.json?ref=gh-pages&access_token=57eef6413b12cb439b837b8fc4751b3291650de1' -d '{
 "message": "update from api",
 "committer": {
 "name": "USER",
 "email": "[email protected]"
 },
 "content": "[{"a": "aaa","b": "bbb"}]",
 "sha": "c321fe9f6418053ecb87eb3cd2518a4xdfc83ebf"
 }'

Answer:

{
 "message": "**Problems parsing JSON**",
 "documentation_url": "https://developer.github.com/v3/repos/contents/"
}

Instead of

"[{"a": "aaa","b": "bbb"}]"

I've tried

"[{\"a\": \"aaa",\"b\": \"bbb\"}]"

but then I get the following error:

{
 "message": "**content is not valid Base64**",
 "documentation_url": "https://developer.github.com/v3/repos/contents/"
}

Best,

Jonathon Reinhart
139k38 gold badges266 silver badges347 bronze badges
asked Feb 9, 2017 at 12:35
2
  • Stack overflow isn't a forum. If you look at other questions and answers, you'll see that we don't edit questions and mark their titles as "SOLVED". Instead, you are expected to up-vote all answers that help, and accept the answer that best solves your problem by clicking the green check mark next to it. Commented Feb 18, 2017 at 15:40
  • Also, don't edit your question to drastically change what it is asking. Doing so will render all of the answers invalid or irrelevant. If you have more questions, ask a new question. Commented Feb 18, 2017 at 15:42

1 Answer 1

1

If you open the URL to the documentation given in the error response, you'll see that the content needs to be Base64 encoded.

answered Feb 9, 2017 at 12:40
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.