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

dotty items #93

Open
johnwlockwood opened this issue Sep 12, 2022 · 0 comments
Open

dotty items #93

johnwlockwood opened this issue Sep 12, 2022 · 0 comments

Comments

@johnwlockwood
Copy link

I'd like to be able to iterate over items of a dotty, where it returns the dotty key and value.

d = dotty({"foo": [{"food": [{"sand": "meat"}]},{"drink": [{"tea":"black", "soda": "cream"}]}]})

>> for k, v in d.dotty_items(breadth_first=True):
>>     print(k)
"foo"
"foo.0"
"foo.1"
"foo.0.food"
"foo.0.food.0"
"foo.0.food.0.sand"
"foo.1.drink"
"foo.1.drink.0"
"foo.1.drink.0.tea"
"foo.1.drink.0.soda"

maybe have method params for a key to start at and a depth limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant