Need Guidance : how to create a reusable expression and pass JSON into the engine for quick evaluation #1377
Answered
by
lahma
rajasekarshanmugam
asked this question in
Q&A
Replies: 1 comment 4 replies
-
var engine = new Engine();
const string Json = """{ "invoice": { "id": "inv123" } }""";
engine.SetValue("jsonString", Json);
var id = engine.Evaluate("const obj = JSON.parse(jsonString); obj.invoice.id;").AsString();
Assert.Equal("inv123", id); |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
rajasekarshanmugam
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 have been looking around sample the samples, tests, but could not find something that helps.
Was looking for a way to create an expression/statement that consumes few input variables, then evaluate these same expression using an input that is a JSON. For e.g
Expression:
invoice.id
Input JSON:
{
invoice:
{
id: "inv123"
}
}
Output Expected:
"inv123"
Beta Was this translation helpful? Give feedback.
All reactions