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

Root node fails as an array #12

Closed
satkunas opened this issue Mar 26, 2018 · 1 comment
Closed

Root node fails as an array #12

satkunas opened this issue Mar 26, 2018 · 1 comment

Comments

@satkunas
Copy link

satkunas commented Mar 26, 2018

Assume the following data:

{
    "test": 12.34
}

compiling with $.test works.

However, when the root node is an array:

[{
    "test": 12.34
}]

compiling with either $[0].test or $[:].test fails

@oliveagle
Copy link
Owner

merged. and there are two cases needs to be fixed.

		case "idx":
			if len(s.key) > 0 {
				// no key `$[0].test`
				obj, err = get_key(obj, s.key)
				if err != nil {
					return nil, err
				}
			}

		case "range":
			if len(s.key) > 0 {
				// no key `$[:1].test`
				obj, err = get_key(obj, s.key)
				if err != nil {
					return nil, err
				}
			}

I fixed case range branch.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants