Other people have pointed out ways to approach this with the github API. Your question also leaves open the possibility of doing this with just git, not github. The great thing about JSON is that it's just text, so you can generate it with just git log
.
$ echo "[" && git log -n5 --pretty=format:\"%H\", && echo "]"
[
"216e8824cfac3d3a46eac23fb177566829f2f236",
"8b0357b71fa824114f9db96954b364a8f815fd50",
"bd394fd40184df8b22e45fb6aaa1fc1c3c6dc31a",
"c35af70eaedcdd05b56496e555f33c65286e85ba",
"9e65dfd39de1732bc114bee184f595a6f091680c",
]
I know you will eventually need more detail than that, but it's a starting point.
OK, here's another example. This is fun.
$ echo "[" && git log -n5 --pretty=format:'{ "author": "%an", "subject":"%s" }', && echo "]"
[
{ "author": "Saul Torrell", "subject":"June 21 release - operator systems" },
{ "author": "Saul Torrell", "subject":"Missing topic for june 11 release." },
{ "author": "Saul Torrell", "subject":"June 11 release." },
{ "author": "Saul Torrell", "subject":"new topic." },
{ "author": "Saul Torrell", "subject":"Added extra sauce to the frobnicator." },
]