Get a github folder it's contents as a json file

503 views Asked by At

if I construct this URL, I can see the contents of the images folder as a json in Firefox. https://api.github.com/repos/DessoCode/ESP32/contents/Images?ref=main

However, this doesn't seem to be a true json since my parser doesn't parse this. I'm using an ESP32 and Arduino.

The code works with a true json link. (For example: http://arduinojson.org/example.json) My question is: How do I change the first URL so it has a .json extension?

Thank you so much!

2

There are 2 answers

0
Desso On

I figured it out, I needed to serialize the input stream first, then I could deserialize it and use the values.

0
VonC On

The alternative is to install GitHub CLI gh (through one of the linux_arm64 packages), and use gh api to execute the API call... with -q or --jq <string> to query and select values from the response using jq syntax.
No need to serialize/de serialize.

gh api repos/DessoCode/ESP32/contents/Images?ref=main --jq ".[].path"

Images/robot.bmp
Images/skulltest.bmp
Images/yellow.bmp