Json with a strange name field cannot be parsed

I have this JSON container that has a strange field called "48x48" for a photoUrl.

using Newtonsoft.Json;
(...)
dynamic issuesJson = JsonConvert.DeserializeObject(responseIssues.Content);
foreach (dynamic issue in issuesJson.issues){
      Console.WriteLine(issue.name); //works properly
      Console.WriteLine(issue.48x48); //error -> expected;
}

For some reason Visual Studio doesn't accept the access to this runtime field of this dynamic object. How can I work around this problem? Note: I cannot change the field name.

Thanks anyway.

Jon Skeet
people
quotationmark

For some reason Visual Studio doesn't accept the access to this runtime field of this dynamic object.

Well what you've provided is simply not valid C#. An identifier can't start with a digit. That's still enforced even when you're trying to resolve a member of dynamic.

We don't know what type you're using for issues, but basically you'll need to handle it as a key/value map which you can access by string. Quite how you do that will depend on the implementation of issue. It doesn't look like Json.NET guarantees anything there - you may be able to cast it to JObject, for example:

foreach (JObject issue in issuesJson.issues) {
    Console.WriteLine(issue["48x48"]);
}

people

See more on this question at Stackoverflow