Skip to content

[Bug] Dictionary GetValueByPath key access fails when the key is a integer or int as string. #1

Description

@kle-sd

Hey! Thanks for the great OSS library!

Running into a bug where I have a Dictionary<string, string> which fails when calling GetValueByPath due to the parsing thinking it is an array.

For example -

var dict = new Dictionary<string, string>
{
    ["1"] = "hello world"
};

// throws
var ex = dict.GetValueByPath("[1]");

Relevant code is here, I believe - https://github.com/iyulab/ObjectPath/blob/main/src/ObjectPath/ObjectPath.cs#L38-L41

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions