DAW JSON Link
Loading...
Searching...
No Matches
json_apply

json_apply parses the document to parameter types specified in signature, then passes them to the Callable for evaluation. This is similar to std::apply but using a JSON documents instead of tuples.

Uses

json_apply is useful in IPC/RPC situations where the data is (de)serialized from/to JSON, such as JSON RPC or IPC with web views.

Example

++
struct NumberX {
int x;
};
// ...
R"json({"x":10})json",
[]( NumberX nx ) {
return nx.x;
} );
assert( x == 10 );
constexpr auto json_apply(String &&json_doc, Callable &&callable)
Parse to parameters specified in signature and pass them to Callable for evaluation....