Runtime playground
Configure inputs. Run the engine. Inspect the outcome.
Feature guide & JSON format
All public engine operations are available above. Definitions accept full engine metadata. JSON enums use their names.
Expressions: arithmetic, comparisons, boolean logic, paths, strings, nulls, aggregates and built-in functions. Context supports executionTime, correlationId, userId, tenantId and variables; locals are a JSON dictionary.
Models: all data types including enums and arrays, defaults, formulas, conditional requirements, validations, embedded rules, inference, typed reads and mutation modes.
Commands: array with type: SetValue (path, value), AddItem (collectionPath, value), InsertItem (collectionPath, index, value), RemoveItem (path), RemoveWhere (collectionPath, predicate), ClearCollection (collectionPath), MoveItem (collectionPath, fromIndex, toIndex). Optional origin uses ChangeOrigin names.
Rules: types, scopes, priorities, execution modes, stop behavior and trace. Unsupported engine rule types return diagnostics.
Workflows: guarded/manual/automatic transitions, priorities, entry/exit/transition actions and history. Mock results support success, output, events and diagnostics; unregistered actions exercise engine errors.
Serialization: import/export definitions, instances and packages. Paste import JSON directly, without outer string quotes.
Ready when you are
Run an operation to see values, validation messages, changes and events.
03C# usageCurrent inputs · expand to integrate
Examples follow your current edits, not the last execution. Reference the DynamicRuntime core project in a .NET 10 console application. Code is generated locally and never executed here.
JSON payloads use the engine serializer options; commands use explicit constructors because their JSON discriminator is Workbench-specific.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Threading;
using System.Threading.Tasks;
using DynamicRuntime;
var engine = new DynamicRuntimeEngine();
var json = RuntimeSerializer.CreateDefaultOptions();
var expression = "Round(loan.amount * loan.rate / 100, 2)";
var data = JsonNode.Parse(
"""
{
"loan": {
"amount": 10000,
"rate": 6.5
},
"items": [
{
"price": 50
},
{
"price": 75
}
]
}
""")!.AsObject();
var context = JsonSerializer.Deserialize<RuntimeExecutionContext>(
"""
{}
""", json)!;
var locals = JsonSerializer.Deserialize<IReadOnlyDictionary<string, object>>(
"""
{}
""", json)!;
var result = engine.Expressions.Evaluate(expression: expression, data: data, context: context, locals: locals);
Console.WriteLine(JsonSerializer.Serialize(result, json));
foreach (var diagnostic in result.Diagnostics)
Console.WriteLine($"{diagnostic.Code}: {diagnostic.Message}");
if (!result.Success) return; // Handle failure before consuming or persisting results.
// Use result.As<T>() when a specific result type is required; check conversion.Success too.