-
Notifications
You must be signed in to change notification settings - Fork 52
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
Accessing data using var path inside an array #87
Comments
@joaoandre do you remember how we solve this issue? |
Actually upon further testing it appears that when using So there may be a difference in the golang package with Although I will say I like the behavior of |
Is the |
This is unspecified behavior in JSON Logic that prevents most interpreters from being able to do this. The way {"some": [{ "var": "attributes.parents" }, {"==": [{ "var": "id" }, { "var": "../../subject.id" }]}]} Would be the way this gets written. See:
This is partly why I've opened #89, as I believe it would be ideal for the community to come together to identify solutions for these types of common gaps. |
Hey, not sure if this is best place to post this question, as I don't think it is a problem with the golang jsonlogic as I am noticing the same behavior in go as I do in the play.html page on jsonlogic, but I'm trying to figure out how I can compare array values against data outside of the array
I know that
var
inside of an array is relative, so{ "var": "id" }
appears to work, but is there any way I could check that against data outside of the array like thesubject.id
. Ifvar
inside an array is only relative, is the only solution to add a custom operator likeabsolute_var
, if yes, if there any online examples where I could understand how to write an operator like that in golangRule:
{"some": [{ "var": "attributes.parents" }, {"==": [{ "var": "id" }, { "var": "subject.id" }]}]}
Data:
{ "subject": { "id": "hugh", }, "attributes": { "parents": [ { "id": "ryan" }, { "id": "hugh" }, ] } }
The text was updated successfully, but these errors were encountered: