I have this String stored in my database:
str = "{ "context_name": { "lower_bound": "value", "upper_bound": "value", "values": [ "value1", "valueN" ] } }"
This string is already in the JSON format but I want to convert it into a JObject or JSON Object.
JObject json = new JObject();
I tried the json = (JObject)str;
cast but it didn't work so how can I do it?
This works for me using
JsonConvert
if you don't want or need a typed object try:
or try for a typed object try:
This works
You can try like following:
JObject
defines methodParse
for this:You might want to refer to Json.NET documentation.
there's an interesting way to achive another goal which is to have a strongly type class base on json with a very powerfull tools that i used few days ago for first time to translate tradedoubler json result into classes
Is a simple tool: copy your json source paste and in few second you will have a strongly typed class json oriented . In this manner you will use these classes which is more powerful and simply to use.
I hope that can help you