using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json.Converters;
public partial class ExternalReference
public Data Data { get; set; }
[JsonProperty("included")]
public List<object> Included { get; set; }
public Meta Meta { get; set; }
public partial class Data
public string Type { get; set; }
public string Id { get; set; }
[JsonProperty("attributes")]
public Attributes Attributes { get; set; }
[JsonProperty("relationships")]
public Relationships Relationships { get; set; }
public Links Links { get; set; }
public partial class Attributes
[JsonProperty("externalReferences")]
public List<ExternalReferenceElement> ExternalReferences { get; set; }
public partial class ExternalReferenceElement
[JsonProperty("externalSystem")]
public string ExternalSystem { get; set; }
public partial class Links
public string Self { get; set; }
public partial class Relationships
public partial class Meta
[JsonProperty("totalRows")]
public long TotalRows { get; set; }
public partial class ExternalReference
public static ExternalReference FromJson(string json)
return JsonConvert.DeserializeObject<ExternalReference>(json, Test.Converter.Settings);
public static class Serialize
public static string ToJson(this ExternalReference self)
return JsonConvert.SerializeObject(self, Test.Converter.Settings);
internal static class Converter
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
public static void Main()
var externalReference = ExternalReference.FromJson("{\"data\":{\"type\":\"party-w-external-reference\",\"id\":\"20-3407\",\"attributes\":{\"externalReferences\":[{\"externalSystem\":\"FISCAL\"},{\"externalSystem\":\"FISCALCLNT\"}]},\"relationships\":{},\"links\":{\"self\":\"/api/party-w-external-reference/20-3407\"}},\"included\":[],\"meta\":{\"totalRows\":1}}");
Console.WriteLine(externalReference.Data.Attributes.ExternalReferences.Count);