Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

?json=URL parameter for loading JSON data #54

Closed
simonw opened this issue Nov 15, 2022 · 5 comments
Closed

?json=URL parameter for loading JSON data #54

simonw opened this issue Nov 15, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Nov 15, 2022

Support both a JSON file that's a list of objects and a JSON file which is an object but where one of the keys is a list of objects (pick the key with the most objects in it).

@simonw simonw added the enhancement New feature or request label Nov 15, 2022
simonw added a commit that referenced this issue Nov 15, 2022
@simonw
Copy link
Owner Author

simonw commented Nov 15, 2022

This first implementation only handles [{...}, {...}] documents - I've not yet implemented the idea where {"items": [{...}]} could work too.

@simonw simonw closed this as completed Nov 16, 2022
@simonw
Copy link
Owner Author

simonw commented Nov 16, 2022

I'm just going to implement it such that it searches for the first key of the dictionary that's a list with at least one object in it.

@simonw
Copy link
Owner Author

simonw commented Nov 16, 2022

Got it working such that if the data has NO lists of objects in it you get this error:

image

For this example: https://github.com/simonw/datasette/blob/main/package.json

But if the data DOES have a list of objects it works - e.g. for https://github.com/simonw/usgs-scraper/blob/main/usgs.json

@simonw
Copy link
Owner Author

simonw commented Nov 16, 2022

ajparsons pushed a commit to mysociety/datasette-lite that referenced this issue Sep 11, 2023
ajparsons pushed a commit to mysociety/datasette-lite that referenced this issue Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant