1- using System ;
1+ using System ;
22using System . Collections . Generic ;
33using System . Linq ;
44using System . Linq . Expressions ;
5+ using System . Text . Json . Serialization ;
56using IPData . Helpers . Extensions ;
6- using Newtonsoft . Json ;
77
88namespace IPData . Models
99{
1010 public class IPLookupResult
1111 {
12- [ JsonProperty ( "ip" , NullValueHandling = NullValueHandling . Ignore ) ]
12+ [ JsonPropertyName ( "ip" ) ]
1313 public string Ip { get ; set ; }
1414
15- [ JsonProperty ( "is_eu" , NullValueHandling = NullValueHandling . Ignore ) ]
15+ [ JsonPropertyName ( "is_eu" ) ]
1616 public bool ? IsEu { get ; set ; }
1717
18- [ JsonProperty ( "city" , NullValueHandling = NullValueHandling . Ignore ) ]
18+ [ JsonPropertyName ( "city" ) ]
1919 public string City { get ; set ; }
2020
21- [ JsonProperty ( "region" , NullValueHandling = NullValueHandling . Ignore ) ]
21+ [ JsonPropertyName ( "region" ) ]
2222 public string Region { get ; set ; }
2323
24- [ JsonProperty ( "region_code" , NullValueHandling = NullValueHandling . Ignore ) ]
24+ [ JsonPropertyName ( "region_code" ) ]
2525 public string RegionCode { get ; set ; }
2626
27- [ JsonProperty ( "country_name" , NullValueHandling = NullValueHandling . Ignore ) ]
27+ [ JsonPropertyName ( "country_name" ) ]
2828 public string CountryName { get ; set ; }
2929
30- [ JsonProperty ( "country_code" , NullValueHandling = NullValueHandling . Ignore ) ]
30+ [ JsonPropertyName ( "country_code" ) ]
3131 public string CountryCode { get ; set ; }
3232
33- [ JsonProperty ( "continent_name" , NullValueHandling = NullValueHandling . Ignore ) ]
33+ [ JsonPropertyName ( "continent_name" ) ]
3434 public string ContinentName { get ; set ; }
3535
36- [ JsonProperty ( "continent_code" , NullValueHandling = NullValueHandling . Ignore ) ]
36+ [ JsonPropertyName ( "continent_code" ) ]
3737 public string ContinentCode { get ; set ; }
3838
39- [ JsonProperty ( "latitude" , NullValueHandling = NullValueHandling . Ignore ) ]
39+ [ JsonPropertyName ( "latitude" ) ]
4040 public double ? Latitude { get ; set ; }
4141
42- [ JsonProperty ( "longitude" , NullValueHandling = NullValueHandling . Ignore ) ]
42+ [ JsonPropertyName ( "longitude" ) ]
4343 public double ? Longitude { get ; set ; }
4444
45- [ JsonProperty ( "asn" , NullValueHandling = NullValueHandling . Ignore ) ]
45+ [ JsonPropertyName ( "asn" ) ]
4646 public AsnInfo Asn { get ; set ; }
4747
48- [ JsonProperty ( "organisation" , NullValueHandling = NullValueHandling . Ignore ) ]
48+ [ JsonPropertyName ( "organisation" ) ]
4949 public string Organisation { get ; set ; }
5050
51- [ JsonProperty ( "postal" , NullValueHandling = NullValueHandling . Ignore ) ]
51+ [ JsonPropertyName ( "postal" ) ]
5252 public string Postal { get ; set ; }
5353
54- [ JsonProperty ( "calling_code" , NullValueHandling = NullValueHandling . Ignore ) ]
54+ [ JsonPropertyName ( "calling_code" ) ]
5555 public string CallingCode { get ; set ; }
5656
57- [ JsonProperty ( "flag" , NullValueHandling = NullValueHandling . Ignore ) ]
57+ [ JsonPropertyName ( "flag" ) ]
5858 public Uri Flag { get ; set ; }
5959
60- [ JsonProperty ( "emoji_flag" , NullValueHandling = NullValueHandling . Ignore ) ]
60+ [ JsonPropertyName ( "emoji_flag" ) ]
6161 public string EmojiFlag { get ; set ; }
6262
63- [ JsonProperty ( "emoji_unicode" , NullValueHandling = NullValueHandling . Ignore ) ]
63+ [ JsonPropertyName ( "emoji_unicode" ) ]
6464 public string EmojiUnicode { get ; set ; }
6565
66- [ JsonProperty ( "languages" ) ]
66+ [ JsonPropertyName ( "languages" ) ]
6767 public List < Language > Languages { get ; private set ; } = new List < Language > ( ) ;
6868
69- [ JsonProperty ( "currency" ) ]
69+ [ JsonPropertyName ( "currency" ) ]
7070 public Currency Currency { get ; set ; }
7171
72- [ JsonProperty ( "time_zone" ) ]
72+ [ JsonPropertyName ( "time_zone" ) ]
7373 public TimeZone TimeZone { get ; set ; }
7474
75- [ JsonProperty ( "threat" ) ]
75+ [ JsonPropertyName ( "threat" ) ]
7676 public Threat Threat { get ; set ; }
7777
78- [ JsonProperty ( "region_type" , NullValueHandling = NullValueHandling . Ignore ) ]
78+ [ JsonPropertyName ( "region_type" ) ]
7979 public string RegionType { get ; set ; }
8080
81- [ JsonProperty ( "carrier" , NullValueHandling = NullValueHandling . Ignore ) ]
81+ [ JsonPropertyName ( "carrier" ) ]
8282 public CarrierInfo Carrier { get ; set ; }
8383
84- [ JsonProperty ( "company" , NullValueHandling = NullValueHandling . Ignore ) ]
84+ [ JsonPropertyName ( "company" ) ]
8585 public CompanyInfo Company { get ; set ; }
8686
87- [ JsonProperty ( "status" , NullValueHandling = NullValueHandling . Ignore ) ]
87+ [ JsonPropertyName ( "status" ) ]
8888 public int ? Status { get ; set ; }
8989
90- [ JsonProperty ( "count" ) ]
90+ [ JsonPropertyName ( "count" ) ]
9191 public int Count { get ; set ; }
9292
9393 internal static string FieldName ( Expression < Func < IPLookupResult , object > > expression )
9494 {
9595 var propName = expression . PropertyName ( ) ;
9696 var attribute = typeof ( IPLookupResult )
9797 . GetProperty ( propName )
98- ? . GetCustomAttributes ( typeof ( JsonPropertyAttribute ) , false )
99- . Single ( ) as JsonPropertyAttribute ;
98+ ? . GetCustomAttributes ( typeof ( JsonPropertyNameAttribute ) , false )
99+ . Single ( ) as JsonPropertyNameAttribute ;
100100
101- return attribute ? . PropertyName ?? string . Empty ;
101+ return attribute ? . Name ?? string . Empty ;
102102 }
103103 }
104- }
104+ }
0 commit comments