File tree 1 file changed +8
-5
lines changed
src/JsonApiDotNetCore/Errors
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using System . Linq ;
4
+ using System . Text . Encodings . Web ;
5
+ using System . Text . Json ;
6
+ using System . Text . Json . Serialization ;
4
7
using JetBrains . Annotations ;
5
8
using JsonApiDotNetCore . Serialization . Objects ;
6
- using Newtonsoft . Json ;
7
9
8
10
namespace JsonApiDotNetCore . Errors
9
11
{
@@ -13,15 +15,16 @@ namespace JsonApiDotNetCore.Errors
13
15
[ PublicAPI ]
14
16
public class JsonApiException : Exception
15
17
{
16
- private static readonly JsonSerializerSettings ErrorSerializerSettings = new ( )
18
+ private static readonly JsonSerializerOptions SerializerOptions = new ( )
17
19
{
18
- NullValueHandling = NullValueHandling . Ignore ,
19
- Formatting = Formatting . Indented
20
+ WriteIndented = true ,
21
+ Encoder = JavaScriptEncoder . UnsafeRelaxedJsonEscaping ,
22
+ DefaultIgnoreCondition = JsonIgnoreCondition . WhenWritingNull
20
23
} ;
21
24
22
25
public IReadOnlyList < Error > Errors { get ; }
23
26
24
- public override string Message => $ "Errors = { JsonConvert . SerializeObject ( Errors , ErrorSerializerSettings ) } ";
27
+ public override string Message => $ "Errors = { JsonSerializer . Serialize ( Errors , SerializerOptions ) } ";
25
28
26
29
public JsonApiException ( Error error , Exception innerException = null )
27
30
: base ( null , innerException )
You can’t perform that action at this time.
0 commit comments