Skip to content

Use Dot String to Access DotMap Paths #57

Description

@awagneratzendesk

I have a piece of software that outputs dictionary mapping in dot notation. I was hoping to be able to assign the dot notation to a variable and pass it to a DotMap for a lookup but that does not seem possible.

mydict = {
  "my": {
      "dot": {
        "notation": 1
      }
    }
}
m = DotMap(mydict)
my_dotnotation = "my.dot.notation"

print(m.lookup(my_dotnotation)

I would expect that code to print "1". Just noting this down here as a nice to have given that it looks like that is what #27 was also looking for.

https://github.com/cdgriffith/Box#box-dots actually looks to have that functionality.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions