Skip to content

Support for stdClass and ArrayAccess #2

Description

@ashokadewit

The implementation of Field supports only associative arrays: https://github.com/jmespath-community/php-jmespath/blob/master/src/node/Field.php#L24

Has it been considered to support stdClass or ArrayAccess? Both are supported by the implementation of mtdowling: https://github.com/jmespath/jmespath.php/blob/master/src/TreeInterpreter.php#L48-L52

When working with JSON it's more reliable to decode it as stdClass instead of an associative array. Associative arrays can cast properties to integers and there is no difference between an empty object and an empty array.

Implementing ArrayAccess is useful to retrieve values with JMESPath from objects that contain data without having to convert them to arrays.

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

    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