Skip to content

Problem Serialising Array / Enumerable. #101

Description

@robert-af

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")]publicclassProductDto{publicintId{get;privateset;}publicstringName{get;privateset;}publicProductDto(intid,stringname){Id=id;Name=name;}publicoverridestringToString(){returnstring.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:

usingJSONAPI.EntityFramework;// For pluralisation service.usingJSONAPI.Json;// ...varformatter=newJsonApiFormatter{PluralizationService=newPluralizationService()};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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions