The binary operator Equal is not defined for the types 'System.Text.Json.JsonElement' and 'System.String'. #665
Unanswered
AMarburger
asked this question in
Q&A
Replies: 1 comment
-
I had the same problem, I think it happened after they changed the NewtonSoft.Json for System.Text.Json: I made a PR with changes that work for me: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've downloaded the latest version of this repo and am running it locally.
I began to debug the code to understand how it works, and I noticed a series of exceptions being thrown (see RuleResultTree.ExecptionMessage below).
Just in case I did not understand how this was supposed to work, I updated the basicInfo in the JSONDemo to ensure one of the rules would come back as true, but I continued to get the same error messages.
Anyone have any suggestions to get this to run?
JSONDemo.cs
var basicInfo = "{"name": "hello","email": "abcy@xyz.com","creditHistory": "good","country": "canada","loyaltyFactor": 3,"totalPurchasesToDate": 10000}";
var basicInfo = "{"name": "hello","email": "abcy@xyz.com","creditHistory": "good","country": "india","loyaltyFactor": 3,"totalPurchasesToDate": 10000}";
Discount.json
"WorkflowName": "Discount",
"Rules": [
{
"RuleName": "GiveDiscount10",
"SuccessEvent": "10",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input1.country == "india" AND input1.loyaltyFactor <= 2 AND input1.totalPurchasesToDate >= 5000 AND input2.totalOrders > 2 AND input3.noOfVisitsPerMonth > 2"
},
{
"RuleName": "GiveDiscount20",
"SuccessEvent": "20",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input1.country == "india" AND input1.loyaltyFactor == 3 AND input1.totalPurchasesToDate >= 10000 AND input2.totalOrders > 2 AND input3.noOfVisitsPerMonth > 2"
},
{
"RuleName": "GiveDiscount25",
"SuccessEvent": "25",
"ErrorMessage": "One or more adjust rules failed.",
"ErrorType": "Error",
"RuleExpressionType": "LambdaExpression",
"Expression": "input1.country != "india" AND input1.loyaltyFactor >= 2 AND input1.totalPurchasesToDate >= 10000 AND input2.totalOrders > 2 AND input3.noOfVisitsPerMonth > 5"
}
]
RuleResultTree.ExecptionMessage
Exception while parsing expression
input1.country == "india" AND input1.loyaltyFactor <= 2 AND input1.totalPurchasesToDate >= 5000 AND input2.totalOrders > 2 AND input3.noOfVisitsPerMonth > 2
- The binary operator Equal is not defined for the typesBeta Was this translation helpful? Give feedback.
All reactions