Convert python object to jObject in C#

Sant Lipi 1 Reputation point
2021-07-03T10:42:32.873+00:00

Hi ,
Below i am using Jobject trying to convert payton to c#.

Python object which is assigned new value.
Payload["test1"]["test2"] = {"value": "example", "source":15};

In C#

Payload["test1"]["test2"] = JObject.FromObject(new Dictionary<object,object>
{
{
"value","example"
},
{
"source",15
}
});

Is it the right way of assing value to payload in c#

Developer technologies ASP.NET ASP.NET Core
Developer technologies C#
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.