Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem with your json is that if RoomImage has a single element, your service returns it as an object <code>{}</code> not as an array of objects <code>[{}]</code>.</p> <p><img src="https://i.stack.imgur.com/2bmgD.png" alt="enter image description here"></p> <p>So If you want to use type-safe classes in your code(since dynamically accessing is also possible) you should pre-process your json before deserializing. Below code works (of course, as everybody says, using <a href="http://json.codeplex.com/" rel="nofollow noreferrer"><em>Json.Net</em></a>)</p> <pre><code>string json = your__json__string //PreProcess var jobj = JObject.Parse(json); foreach (var j in jobj["ObjectList"]) { if (!(j["RoomImage"] is JArray)) { j["RoomImage"] = new JArray(j["RoomImage"]); } } var obj = JsonConvert.DeserializeObject&lt;RootObject&gt;(jobj.ToString()); </code></pre> <hr> <pre><code>public class InternalOnly { public string RoomId { get; set; } public string FloorId { get; set; } } public class RoomImage { public string ImagePath { get; set; } public string ImageType { get; set; } public string CreatedDate { get; set; } public string CreatedId { get; set; } public string LastUpdateDate { get; set; } public string LastUpdateId { get; set; } } public class ObjectList { public string Name { get; set; } public string EmailAddress { get; set; } public string RoomListEmailAddress { get; set; } public string MinimumXCoordinateInMap { get; set; } public string MinimumYCoordinateInMap { get; set; } public string MaximumXCoordinateInMap { get; set; } public string MaximumYCoordinateInMap { get; set; } public string RoomCapacity { get; set; } public RoomImage[] RoomImage { get; set; } public string FloorName { get; set; } public string CreatedDate { get; set; } public string CreatedId { get; set; } public string LastUpdatedDate { get; set; } public string LastUpdatedId { get; set; } public string IsRestrictedRoom { get; set; } public InternalOnly InternalOnly { get; set; } public object Equipment { get; set; } } public class RootObject { public List&lt;ObjectList&gt; ObjectList { get; set; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload