-
Notifications
You must be signed in to change notification settings - Fork 144
Open
Description
I didn't notice whether you had or planned to develop functions that included arrays that contained objects.
So for example if wanted to return true if there is an apple pie in group of pies:
var rules = { "and" : [
{"<" : [ { "var" : "temp" }, 110 ]},
{"==" : [ { "var" : "pies.filling" }, "apple" ] }
] };
var data = { "temp" : 100, "pies" : [{ "filling" : "apple" }, { "filling" : "cherry" }]};
jsonLogic.apply(rules, data);
// true
Activity
jwadhams commentedon Nov 10, 2016
You could build a custom operaton using dotty's search method and then using that with
in
, likeDoes that work?
internalfx commentedon Feb 28, 2017
Had the same problem.
This is a common use case, and should be added to core.
@jwadhams thank you for the solution.
internalfx commentedon Feb 28, 2017
@PaulKruger please see #25
yarnball commentedon Jan 30, 2018
Thanks for your example above.
I am trying to filter on multiple nested fields. However, it isn't returning any results. Any suggestions?