moswald
moswald

Reputation: 11677

string to JsonObject in C#

What is the best way to convert a (properly Json-formatted) String object into a System.Json.JsonObject? Right now I create a StringReader and use System.Json.JsonObject.Load.

(This is really kind of academic, since I think I'll always be dealing with the raw Json in System.IO.Stream form.)

Upvotes: 4

Views: 1629

Answers (1)

AnthonyWJones
AnthonyWJones

Reputation: 189457

You could simply use the System.Json.JsonValue.Parse static method to parse a string directly rather than use a StringReader.

Upvotes: 4

Related Questions