Open
Description
Version - 0.2.0.0 (nuget)
When serialising an array or enumerable, I get the following formatted output:
{
"products":{
"id":"NOIDCOMPUTABLE!",
"length":3,
"longLength":3,
"rank":1,
"isReadOnly":false,
"isFixedSize":true,
"isSynchronized":false,
"links":{
"syncRoot":"NOIDCOMPUTABLE!"
}
}
The class being serialised is:
[JsonObject(Title = "product")]
public class ProductDto
{
public int Id { get; private set; }
public string Name { get; private set; }
public ProductDto(int id, string name)
{
Id = id;
Name = name;
}
public override string ToString()
{
return string.Format("ProductDto [Id: {0}, Name: {1}]", Id, Name);
}
}
If I serialise one of these (instead of an array) I get the expected output:
{"products":{"id":"1","name":"bob"}}
This is running in a Web Api 2 project, with the following setup code in WebApiConfig.cs
:
using JSONAPI.EntityFramework; // For pluralisation service.
using JSONAPI.Json;
// ...
var formatter = new JsonApiFormatter { PluralizationService = new PluralizationService() };
config.Formatters.Add(formatter);
Is there anything I am missing here? I've searched other open issues (and Stackoverflow) but couldn't see this mentioned anywhere.
Thanks.
Metadata
Metadata
Assignees
Labels
No labels