0

I currently have something like this

object t = JsonConvert.DeserializeObject(mystring);

Now when I browse it, it has a property "Root" which has a string in it that I need. How do I access that property?

Salah Akbari
  • 39,330
  • 10
  • 79
  • 109
MistyD
  • 16,373
  • 40
  • 138
  • 240

1 Answers1

0

You can simply use a POCO class:

public class Poco
{  
    [JsonProperty("Root")]
    public string Root { get; set; }
}

Then you can deserialize your JSON to this specified type and access their properties, something like this:

var root = (JsonConvert.DeserializeObject<Poco>(mystring)).Root;
Salah Akbari
  • 39,330
  • 10
  • 79
  • 109