.Net Core 3.1 dynamic object of type JsonElement

Viewed 1322

We're migrating an Asp.Net Framework project to .Net Core 3.1. The sites uses SignalR and payload are sent from the frontend and received as dynamic object at the backend:

Frontend:

var hostData = {
    "foo": "Bar"
};

connection.invoke("echo", hostData);

Backend:

public async Task echo(dynamic data)
{
    var fooValue = data.foo;  
}

This worked fine in .Net Framework but in .Net Core 3.1 it becomes a object (System.Text.JsonElement). I know I can use a strongly typed object instead, but as I don't want to update all methods, I'd rather keep it as a dynamic. - Is this possible?

0 Answers
Related