Breeze / breeze.server.net

Breeze support for .NET servers
MIT License
76 stars 62 forks source link

Expand - SyntaxError: JSON.parse: end of data after property value... #73

Closed JustinLutsky closed 6 years ago

JustinLutsky commented 6 years ago

Any help on this wold be greatly appreciated. Using AspNetCore 0.1.2 and ASP.NET Core 2.1.

Whey trying to query with 'expand' I keep getting a version of the following with all entities. For example:

https://localhost:44382/breeze/Accounts?{%22expand%22%3A[%22users%22]}

Error > SyntaxError: JSON.parse: end of data after property value in object at line 1 column 137 of the JSON data

Raw Data > {"results":[{"id":1,"customers":[],"guid":"1601a615-3b57-4f71-a0ff-f060b8467565","name":"OC SCUBA Center","users":[{"id":1,"accountId":1

Here are the entity models for reference:

public class AccountEntity
{
    [Key]
    public int id { get; set; }

    public List<CustomerEntity> customers { get; set; } = new List<CustomerEntity>();

    public Guid guid { get; set; } = Guid.NewGuid();

    [Required]
    [MaxLength(50)]
    public string name { get; set; }

    public List<UserEntity> users { get; set; } = new List<UserEntity>();

    public List<WorkOrderEntity> workOrders { get; set; } = new List<WorkOrderEntity>();
}

public class UserEntity
{
    [Key]
    public int id { get; set; }

    public int accountId { get; set; }
    public AccountEntity account { get; set; }

    [Required]
    public string firstName { get; set; }

    public Guid guid { get; set; } = Guid.NewGuid();

    [Required]
    public string lastName { get; set; }

    [Required]
    public string phone { get; set; }

    [Required]
    public string email { get; set; }

    public List<WorkOrderItemLogEntity> workOrderItemLogs { get; set; } = new List<WorkOrderItemLogEntity>();
}