diff --git a/src/Csg.ListQuery.AspNetCore/Csg.ListQuery.AspNetCore.csproj b/src/Csg.ListQuery.AspNetCore/Csg.ListQuery.AspNetCore.csproj index 8b32a11..b9519ba 100644 --- a/src/Csg.ListQuery.AspNetCore/Csg.ListQuery.AspNetCore.csproj +++ b/src/Csg.ListQuery.AspNetCore/Csg.ListQuery.AspNetCore.csproj @@ -9,7 +9,6 @@ - diff --git a/src/Csg.ListQuery.AspNetCore/PropertyHelper.cs b/src/Csg.ListQuery.AspNetCore/PropertyHelper.cs index 6b38c4b..832da23 100644 --- a/src/Csg.ListQuery.AspNetCore/PropertyHelper.cs +++ b/src/Csg.ListQuery.AspNetCore/PropertyHelper.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; +using System.Text.Json.Serialization; namespace Csg.ListQuery.AspNetCore { @@ -25,11 +25,11 @@ public static Dictionary GetProperties(Type type, .Select(prop => { var propInfo = new ListItemPropertyInfo(); - var jsonPropertyAttribute = prop.PropertyInfo.GetCustomAttributes(typeof(Newtonsoft.Json.JsonPropertyAttribute), false).FirstOrDefault(); + var jsonPropertyAttribute = prop.PropertyInfo.GetCustomAttributes(typeof(JsonPropertyNameAttribute), false).FirstOrDefault(); propInfo.Property = prop.PropertyInfo; propInfo.PropertyName = prop.Name; - propInfo.JsonName = ((Newtonsoft.Json.JsonPropertyAttribute)jsonPropertyAttribute)?.PropertyName ?? prop.Name; + propInfo.JsonName = ((JsonPropertyNameAttribute)jsonPropertyAttribute)?.Name ?? prop.Name; propInfo.IsFilterable = prop.IsFilterable == true; propInfo.IsSortable = prop.IsSortable == true; propInfo.Description = prop.Description; diff --git a/src/Csg.ListQuery.JsonApi.Abstractions/Csg.ListQuery.JsonApi.Abstractions.csproj b/src/Csg.ListQuery.JsonApi.Abstractions/Csg.ListQuery.JsonApi.Abstractions.csproj index e381270..c59bb72 100644 --- a/src/Csg.ListQuery.JsonApi.Abstractions/Csg.ListQuery.JsonApi.Abstractions.csproj +++ b/src/Csg.ListQuery.JsonApi.Abstractions/Csg.ListQuery.JsonApi.Abstractions.csproj @@ -5,10 +5,6 @@ true - - - - diff --git a/src/Csg.ListQuery.JsonApi.Abstractions/JsonApiListResponse.cs b/src/Csg.ListQuery.JsonApi.Abstractions/JsonApiListResponse.cs index d9a01e5..16201a9 100644 --- a/src/Csg.ListQuery.JsonApi.Abstractions/JsonApiListResponse.cs +++ b/src/Csg.ListQuery.JsonApi.Abstractions/JsonApiListResponse.cs @@ -1,18 +1,18 @@ using Csg.ListQuery.Server; -using Newtonsoft.Json; using System.Collections.Generic; +using System.Text.Json.Serialization; namespace Csg.ListQuery.JsonApi.Abstractions { public class JsonApiListResponse : ListResponse> { - [JsonProperty("data")] + [JsonPropertyName("data")] public override IEnumerable> Data { get => base.Data; set => base.Data = value; } - [JsonProperty("links")] + [JsonPropertyName("links")] public override ListResponseLinks Links { get => base.Links; set => base.Links = value; } - [JsonProperty("meta")] + [JsonPropertyName("meta")] public override ListResponseMeta Meta { get => base.Meta; set => base.Meta = value; } } } diff --git a/src/Csg.ListQuery.JsonApi.Abstractions/JsonApiRecord.cs b/src/Csg.ListQuery.JsonApi.Abstractions/JsonApiRecord.cs index f0c8b7a..dc1c3e4 100644 --- a/src/Csg.ListQuery.JsonApi.Abstractions/JsonApiRecord.cs +++ b/src/Csg.ListQuery.JsonApi.Abstractions/JsonApiRecord.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace Csg.ListQuery.JsonApi.Abstractions { @@ -21,13 +21,13 @@ public JsonApiRecord(string type, string id, TAttributes attributes) : this() this.Attributes = attributes; } - [JsonProperty("type")] + [JsonPropertyName("type")] public string Type { get; set; } - [JsonProperty("id")] + [JsonPropertyName("id")] public string ID { get; set; } - [JsonProperty("attributes")] + [JsonPropertyName("attributes")] public TAttributes Attributes { get; set; } } }