Right-click the project in Solution Explorer, select “Manage NuGet packages…”, go to Browse tab, type “System.Text.Json” and install this package.
Then try this code:
using System.Dynamic;
using System.Text.Json;
. . .
string result = "{\"a\":\"hello\", \"b\":1}";
dynamic data = JsonSerializer.Deserialize<ExpandoObject>( result );
string a = data.a.GetString( );
int b = data.b.GetInt32( );
Using dynamic is not always reasonable. Usually, it is more convenient to define a class for required fields, such as:
class MyData
{
public string a { get; set; }
public int b { get; set; }
}
Then you will write:
MyData data = JsonSerializer.Deserialize<MyData>( result );
string a = data.a;
int b = data.b;
Adjust it according to further operations, which were not shown.
See also DeserializeAsync and https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to.