Hello,
I am filtering some tags and returning the result as JSon:
public JsonResult Filter(string q, int limit) {
var list = (from t in database.Tags
where t.Name.StartsWith(q)
orderby t.Name
select t);
List tags = (limit 0 ? list.Take(limit) : list).ToList();
return this.Json(tags);
} // Filter
Everything works fine if the list is not empty!
If the list is empty I get an error that I caught in FireBug saying:
System.InvalidOperationException: A circular reference was detected
while serializing an object of type 'MyApp.Models.PostsTag'
How can I avoid this problem?
Thanks,
Miguel