Assuming json is a variable containing JSON text, use Jayrock.Json.Conversion.JsonConvert.Import(json) . That you will return in return is either JsonObject , JsonArray , JsonNumber , System.String , System.Boolean , or a null reference depending on the JSON value in the JSON source text. If you know that this will be a JSON object, then you can safely discard the return value or use JsonConvert.Import<JsonObject>(json) .
I would refuse to work with JsonObject directly if you do not depend on only one of its functions. You should just pretend that the JSON object you are returning is a dictionary; either IDictionary or IDictionary<string, object> . With the latest version for the .NET Framework 4, you can also work with JsonObject as a dynamic object.
source share