2
2
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
3
4
4
using System ;
5
+ using System . Text . Json ;
5
6
using System . Threading . Tasks ;
6
- using Microsoft . AspNetCore . Mvc . Core ;
7
7
using Microsoft . AspNetCore . Mvc . Infrastructure ;
8
8
using Microsoft . Extensions . DependencyInjection ;
9
9
@@ -27,14 +27,17 @@ public JsonResult(object value)
27
27
/// Creates a new <see cref="JsonResult"/> with the given <paramref name="value"/>.
28
28
/// </summary>
29
29
/// <param name="value">The value to format as JSON.</param>
30
- /// <param name="serializerSettings">The serializer settings to be used by the formatter.</param>
30
+ /// <param name="serializerSettings">
31
+ /// The serializer settings to be used by the formatter.
32
+ /// <para>
33
+ /// When using <c>System.Text.Json</c>, this should be an instance of <see cref="JsonSerializerOptions" />.
34
+ /// </para>
35
+ /// <para>
36
+ /// When using <c>Newtonsoft.Json</c>, this should be an instance of <c>JsonSerializerSettings</c>.
37
+ /// </para>
38
+ /// </param>
31
39
public JsonResult ( object value , object serializerSettings )
32
40
{
33
- if ( serializerSettings == null )
34
- {
35
- throw new ArgumentNullException ( nameof ( serializerSettings ) ) ;
36
- }
37
-
38
41
Value = value ;
39
42
SerializerSettings = serializerSettings ;
40
43
}
@@ -46,6 +49,12 @@ public JsonResult(object value, object serializerSettings)
46
49
47
50
/// <summary>
48
51
/// Gets or sets the serializer settings.
52
+ /// <para>
53
+ /// When using <c>System.Text.Json</c>, this should be an instance of <see cref="JsonSerializerOptions" />
54
+ /// </para>
55
+ /// <para>
56
+ /// When using <c>Newtonsoft.Json</c>, this should be an instance of <c>JsonSerializerSettings</c>.
57
+ /// </para>
49
58
/// </summary>
50
59
public object SerializerSettings { get ; set ; }
51
60
0 commit comments