question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with jsonlogic type and operator "between ,"not in" and "not between"

See original GitHub issue

I use custom rangeDate component and I need to export field’s object as jsonlogic. I have two dates and operator “between” and it exported like {"<=":["2022-09-22",{"var":"date"},"2022-09-28"]}. When I import this rule to query builder with parseJsonLogic it gives me operator: “<=” and only first value, second value lost. What can I do with it? Moreover if I used “not between” in rule, it gave me a group, which has notToggle:“true” and operator:“between”. I need to disable notToggle and take back operator:“not between”. The same problem with “not in”. How can I get it?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Egor3842commented, Sep 9, 2022

okey, thank you very much for your prompt replies and your efforts)

0reactions
jakeboone02commented, Sep 11, 2022

@Egor3842 - I believe PR #367 fixes the issues with “between” and “in”. It also converts the substring operators (“contains” / “beginsWith” / “endsWith”) to their negating counterparts (“doesNotContain” / “doesNotBeginWith” / “doesNotEndWith”) if a single rule is wrapped in { '!': ... }.

You can try out the query->JsonLogic and JsonLogic->query transformations based on the code from #367 with this codesandbox.

Read more comments on GitHub >

github_iconTop Results From Across the Web

diegoholiveira/jsonlogic - Error if var is missing from data
Hello, I seem to hit a case where the library is returning an error when a property, that is in the "logic" but...
Read more >
Supported Operations
Build complex rules, serialize them as JSON, share them between front-end and back-end. ... Tests not-equal, with type coercion. Logic. {"!=" : [1,...
Read more >
Representing logic as data in JSON
If logical LogicalOperator is left out between conditions, it will automatically joins them with AND; Inner arrays are parsed as nested groups (EG...
Read more >
jsonlogic
This parser accepts JsonLogic rules and executes them in Go. ... 3 values to test that one value is between but not equal...
Read more >
How to store and process rules and logic with JsonLogic
“Build complex rules, serialize them as JSON, share them between ... A foreword for anyone hoping to use JsonLogic in production environment: It's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found