Skip to content

Single quotes are not supported #31

@rob-chkk

Description

@rob-chkk

The JSONPath standard supports single-quotes for bracket notation (see here) but they fail with a syntax error:

m := map[string]interface{}{
  "field": map[string]interface{}{
    "sub-field": "hello",
  },
}
value, err := jsonpath.Get("$.field['sub-field']", m) 
// err is incorrectly set to `could not parse string: invalid syntax`

// the following case works correctly:
value, err := jsonpath.Get("$.field[\"sub-field\"]", m) 
// err is nil, value is "hello"

Instead I'd expect this to work correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions