0

I am trying to deserialize string to Dictionary<string, dynamic> object

string jsonString = "{\r\n \"$ref\":\"3"\r\n}";
var dict = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(jsonString);

but I am getting null value for dict

I have tested it against more complex strings and it worked fine.

Any suggestion ?

Bakri Bitar
  • 1,543
  • 18
  • 29
  • 2
    Try with `string jsonString = "{\r\n \"ref\":\"3\"\r\n}";` :) – Eser Aug 13 '15 at 09:30
  • thanks but I need that exact value, how can i get it – Bakri Bitar Aug 13 '15 at 09:43
  • As you can see from the [JSON.NET documentation](http://www.newtonsoft.com/json/help/html/PreserveObjectReferences.htm), `$ref` is handled specially. [This question](http://stackoverflow.com/questions/2397511/deserializing-ref-and-id) has answers that might help. – Sam Axe Aug 13 '15 at 10:41

0 Answers0