Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 1.25 KB

poco-mapping.md

File metadata and controls

34 lines (24 loc) · 1.25 KB

Mapping JSON fields to POCO properties

[NOTE] The documetation has been updated to reflect that the product name for N1QL has been changed to SQL++, however, the source itself may still use the name N1QL.

While not an actually responsibility of the LINQ provider, the default serialization library, Newtonsoft.Json, supports field the following serialization attributes:

Please refer to their documentation for issues regarding serialization.

Mixing of attribute types is supported by Newtonsoft.Json. Here is an example of mixing JsonPropertyAttribute and DataMemberAttribute:

public class Beer
{
    [Key]
    [JsonProperty("name")]
    public string Name { get; set; }

    [DataMember(Name = "abv")]
    public decimal Abv { get; set; }

    [JsonProperty("ibu")]
    public decimal Ibu { get; set; }

    // ...
}

See Custom JSON Serializers for information on using a custom JSON serializer.