Q:

ASP.NET Web API returns empty collection in json response

OK, I have a problem with the ASP.NET Web API.  I followed this tutorial on how to create it.  I mdified the tutorial for my purposes. 
I have a patch class which has a Collection of download URLs.  The API is returning every information just fine, only the collection of DownloadURLs is returned as null.  
However when I stepped through the code step by step debugging it, it returned the collection properly. 
What did I do wrong.  I'm not able to find my error. 
Here is the Model:
public class Patch
{
    [Key]
    [Required]
    [JsonProperty("PatchVersion")]
    public string PatchVersion { get; set; }

    [Required]
    [JsonProperty("Length")]
    public long Length { get; set; }

    [JsonProperty("VersionToUpdateFrom")]
    public string VersionToUpdateFrom { get; set; }

    [JsonProperty("DownloadUris")]
    public ICollection<DownloadUri> DownloadUris { get; set; }
}

public class DownloadUri
{
    [Key]
    [Required]
    [JsonProperty("AbsolutePath")]
    public string AbsolutePath { get; set; }

    [Required]
    [JsonProperty("IndirectDownload")]
    public bool IndirectDownload { get; set; }
}

This is my DataContext class:
public class PatchesContext : DbContext
{
    public PatchesContext()
        : base("name=PatchesContext")
    {
    }

    public DbSet<Patch> Patches { get; set; }

    public DbSet<DownloadUri> DownloadUris { get; set; }
}

This is the ContextInitializer
public class PatchesContextInitializer : DropCreateDatabaseIfModelChanges<PatchesContext>
{
    protected override void Seed(PatchesContext context)
    {

        var downloadUri = new List<DownloadUri>
        {
            new DownloadUri
            {
                AbsolutePath = "http://downloadUri1.test", IndirectDownload = false
            },
            new DownloadUri
            {
                AbsolutePath = "http://downloadUri2.test", IndirectDownload = false
            }
        };

        var patches = new List<Patch>
        {
            new Patch
            {
                Length = 100000, PatchVersion = "1.0.0.0", VersionToUpdateFrom = string. Empty, DownloadUris = downloadUri
            },
            new Patch
            {
                DownloadUris = null, Length = 10000, PatchVersion = "1.1.0.0", VersionToUpdateFrom = "1.0.0.0"
            }
        };
        patches. ForEach(p => context. Patches. Add(p));
        context. SaveChanges();
    }
}

And finally here is my controller class.  I left out the Post, Put and Delete Methods, because I didn't test them yet (no point if get is not working):
public class AdminController : ApiController
{
    private PatchesContext db = new PatchesContext();

    // GET api/Admin
    public IEnumerable<Patch> GetPatches()
    {
        return db. Patches. AsEnumerable();
    }

    // GET api/Admin/5
    public Patch GetPatch(string version)
    {
        Patch patch = db. Patches. Find(version);
        if (patch == null)
        {
            throw new HttpResponseException(Request. CreateResponse(HttpStatusCode. NotFound));
        }

        return patch;
    }
}

I hope you all can help me and thanks. 
/edit: 
The Header looks like this:
Status Code: 200 OK
Cache-Control: no-cache
Content-Length: 291
Content-Type: application/json; charset=utf-8
Date: Fri, 25 Oct 2013 17:25:48 GMT
Expires: -1
Pragma: no-cache
Server: Microsoft-IIS/8.0
X-SourceFiles: =? UTF-8?B?RTpcVXNlcnNcUm9iZXJ0XERvY3VtZW50c1xWaXN1YWwgU3R1ZGlvIDIwMTJcUHJvamVjdHNcTjQ0V2Vic2l0ZVxONDRXZWJzaXRlXGFwaVxhZG 1pbg==?=

The Response Body looks like this:
[

  {
    "$id": "1",
    "PatchVersion": "1.0.0.0",
    "Length": 100000,
    "VersionToUpdateFrom": "",
    "DownloadUris": null
  },
  {
    "$id": "2",
    "PatchVersion": "1.1.0.0",
    "Length": 10000,
    "VersionToUpdateFrom": "1.0.0.0",
    "DownloadUris": null
  }
]

A:

You are not explicitly loading the Patch. DownloadUris property nor is that property virtual so its not going to lazy load it either. 
Either explicitly load it via an Include for DownloadUris on this line:
Patch patch = db. Patches. Find(version);

to (untested)
Patch patch = db. Patches. Find(version).Include("DownloadUris");

Or make that property virtual and ensure lazy loading is enabled on your context. 
Edit note:
given in your code sample for the Seed method, only Patch (1.0.0.0) will have values for DownloadUris, since in Patch (1.1.0.0) you are setting that property to null

