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

Numeric keys + deep lists = trouble #68

Open
bitnom opened this issue Nov 5, 2020 · 1 comment
Open

Numeric keys + deep lists = trouble #68

bitnom opened this issue Nov 5, 2020 · 1 comment
Assignees
Labels
Feature Request Request for new feature

Comments

@bitnom
Copy link

bitnom commented Nov 5, 2020

Please consider the following:

"2019": {
    "uat": {
      "pkey": true,
      "user": "testval",
      "testkey": true,
      "mylist": [
      {
        "foo": "bar",
        "foo2": "bar2"
      },
      {
        "baz": "milk",
        "bar": "foo"
      }
      ]
    },
    "dev": {
      "pkey": true,
      "testval": "testval",
      "testval2": true
    },
    "test1": [1, 2, "testval"],
    "test2": [{"one": "foo", "two": "bar", "three": "testval"}]
  }
}

There is no way to access deep lists now. If I use no_list=True I will be in trouble because 2019 will work as key but then I can't access mylist. This has me stuck in a project. I've been trying to make some function to parse the key tree and flip no_list on and off while traversing but it's not straight forward what to do.

Reason:

If I need to copy the data schema, I can't make new dotty() and then say:

new["2019.uat.mylist.0"] = dotty(data)

because numeric will always be a list or a key. No mix.

Solution Request:

Identifier for lists in leafy strings. Maybe like:

"2019.uat.mylist.[0]"

@bitnom
Copy link
Author

bitnom commented Nov 6, 2020

@Dysproz Dysproz added the Feature Request Request for new feature label Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Request for new feature
Projects
None yet
Development

No branches or pull requests

3 participants