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

incorrect output when using filters at leaf #15

Open
bytespireio opened this issue Nov 2, 2022 · 0 comments
Open

incorrect output when using filters at leaf #15

bytespireio opened this issue Nov 2, 2022 · 0 comments

Comments

@bytespireio
Copy link

bytespireio commented Nov 2, 2022

hi

For the json path = $['tool']['books'][*]['properties'][*][? (@['name'] == 'moq') ]['value']

the output based on the json below should be ["x","q"]

but i get []

I get the correct output when using

i tried alternative json path json_path='$.tool.books.[*].properties.[*].[?(@.name=="moq")]'

i get weird printed errors = [2022-11-02 15:43:23]-ERROR-[jsonpath] string indices must be integers

sample json is as follows:

{
	"tool": {
		"jsonpath": {
			"creator": {
				"name": "Jayway Inc.",
				"location": [
					"Malmo",
					"San Francisco",
					"Helsingborg"
				]
			}
		},
		"books": [{
				"title": "Beginning JSON",
				"price": 49.99,
				"properties": [{
					"name": "moq",
					"value": "x"
				}, {
					"name": "url",
					"value": "1"
				}]
			},
			{
				"price": 1.99,
				"properties": [{
					"name": "url",
					"value": "3"
				}]
			}, {
				"title": "JSON at Work",
				"price": 29.99,
				"properties": [{
					"name": "moq",
					"value": "q"
				}, {
					"name": "url",
					"value": "2"
				}]
			}
		]

	}
}
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

1 participant