Skip to content

Exception when non default contract resolver is used #18

@mortenbock

Description

@mortenbock

When serializing to Json, an exception is thrown if the default contract resolver is not used.

Code:

Newtonsoft.Json.JsonConvert.DefaultSettings = () => new JsonSerializerSettings{
	ContractResolver = new CamelCasePropertyNamesContractResolver()
};

Review r = new Review {
	Comment = "fdsdf"
};

r.ToIndentedJson().Dump();

Exception:
A member with the name 'comment' already exists on 'MXTires.Microdata.Review'. Use the JsonPropertyAttribute to specify another name.

The ToJson methods should specify the contract resolver explicitly to avoid this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions