pygbif returns invalid json according to jq afaict #1

Closed
opened 2023-09-29 07:43:29 -06:00 by rs-sndid · 1 comment
rs-sndid commented 2023-09-29 07:43:29 -06:00 (Migrated from spacecruft.org)

jq seems picky about it's input, apparently following standards and all that. The json returned from pygbif makes jq barf. Simple example:

from pygbif import species
foo=species.name_suggest(q='Puma concolor')
print(foo)

Then run that like:

$ ./gbif-cruft-json  | jq .
parse error: Invalid numeric literal at line 1, column 8

Perhaps there is a more compliant way to dump, need to check. Anyway, to clean it up for jq need to change single quotes to double quotes, quote True/False, maybe something else, then ok.

`jq` seems picky about it's input, apparently following standards and all that. The json returned from pygbif makes `jq` barf. Simple example: ``` from pygbif import species foo=species.name_suggest(q='Puma concolor') print(foo) ``` Then run that like: ``` $ ./gbif-cruft-json | jq . parse error: Invalid numeric literal at line 1, column 8 ``` Perhaps there is a more compliant way to dump, need to check. Anyway, to clean it up for `jq` need to change single quotes to double quotes, quote True/False, maybe something else, then ok.
rs-sndid commented 2023-09-29 08:25:26 -06:00 (Migrated from spacecruft.org)

Ah just

json.dumps(foo)
Ah just ``` json.dumps(foo) ```
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepcrayon/gbif-cruft#1
No description provided.