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

Array indexes with last return reverse order #118

Closed
lsytj0413 opened this issue Mar 6, 2023 · 4 comments
Closed

Array indexes with last return reverse order #118

lsytj0413 opened this issue Mar 6, 2023 · 4 comments

Comments

@lsytj0413
Copy link

Give this code:

	expr, err := jp.ParseString("$.vals[-3:]")
	if err != nil {
		panic(err)
	}

	result := expr.Get(map[string]interface{}{
		"vals": []int{0, 10, 20, 30, 40, 50},
	})
	fmt.Printf("result: %v\n", result)

the result is: [50 40 30],but it should be [30 40 50],evaluated at https://jsonpath.com/

image

version: v1.17.5

@ohler55
Copy link
Owner

ohler55 commented Mar 6, 2023

I'll get it fixed.

@ohler55
Copy link
Owner

ohler55 commented May 6, 2023

Did release v1.18.0 and later fix the issue?

@ohler55
Copy link
Owner

ohler55 commented May 16, 2023

No response, closing.

@ohler55 ohler55 closed this as completed May 16, 2023
@lsytj0413
Copy link
Author

Did release v1.18.0 and later fix the issue?

Sorry for the late reply. I have test it on v1.18.5,this have been fixed.

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