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
  • 38,126
  • 10
  • 70
  • 102
MistyD
  • 14,915
  • 32
  • 126
  • 215

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
  • 38,126
  • 10
  • 70
  • 102