Ask coding questions

← Back to all posts
How to get all keys with their values with replitdb

I'm working on something that uses python code and Replitdb to make an api. I have to return all the keys with their values in json for each request, but there isn't any way to do this that I can tell. Can anyone tell me how to get a dict of all the keys which I can then convert to json or give me some code to do the same thing? Thanks


Loop through all the keys and print their value, then add them to a dict. Like:

This would print every key in the database.

You can list all the keys with this (check the db tab in the sidebar):