ropensci / fishbaseapi

Fishbase API
https://fishbaseapi.readme.io/
MIT License
42 stars 12 forks source link

option for pretty json? #118

Closed cboettig closed 7 years ago

cboettig commented 7 years ago

@sckott What do you think about having an option for pretty json returns? Often I find it's convenient to check something quickly by just entering the rest call in the browser, but of course the dense JSON return is hard to read.

Obviously eliminating whitespace makes sense for a programmatic interface, but maybe there could be an option for pretty=true in the REST call? (Or default to pretty=TRUE, and use the header to indicate otherwise?)

Just a thought, obviously not a priority.

sckott commented 7 years ago

hmm, not sure how to do it in an API - can look into it.

In chrome and firefox I use pretty JSON extensions https://addons.mozilla.org/en-US/firefox/addon/jsonview/ https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc - But I guess it's kinda unwieldy to tell everyone to install those. I know at least Brave browser didn't have a JSON extension last time I checked.

cboettig commented 7 years ago

good point, probably sufficient to leave this to browser-side add-ons. Can't think of an example of an API that had such an option anyway.

sckott commented 7 years ago

for command line pretty-ness - jq is a good option - curl 'https://fishbase.ropensci.org/faoarref/2/' | jq .