diff --git a/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonInputFormatter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonInputFormatter.cs
index d3d9ce4971..7ba72c0629 100644
--- a/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonInputFormatter.cs
+++ b/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonInputFormatter.cs
@@ -101,9 +101,10 @@ namespace Microsoft.AspNet.Mvc
/// The from which to read.
/// The to use when reading.
/// The used during deserialization.
- public virtual JsonReader CreateJsonReader([NotNull] InputFormatterContext context,
- [NotNull] Stream readStream,
- [NotNull] Encoding effectiveEncoding)
+ protected virtual JsonReader CreateJsonReader(
+ [NotNull] InputFormatterContext context,
+ [NotNull] Stream readStream,
+ [NotNull] Encoding effectiveEncoding)
{
return new JsonTextReader(new StreamReader(readStream, effectiveEncoding));
}
@@ -112,7 +113,7 @@ namespace Microsoft.AspNet.Mvc
/// Called during deserialization to get the .
///
/// The used during serialization and deserialization.
- public virtual JsonSerializer CreateJsonSerializer()
+ protected virtual JsonSerializer CreateJsonSerializer()
{
return JsonSerializer.Create(SerializerSettings);
}
diff --git a/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonOutputFormatter.cs b/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonOutputFormatter.cs
index 27ce61ab5c..790fb2d761 100644
--- a/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonOutputFormatter.cs
+++ b/src/Microsoft.AspNet.Mvc.Extensions/Formatters/JsonOutputFormatter.cs
@@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc.Internal;
@@ -14,14 +13,6 @@ namespace Microsoft.AspNet.Mvc
///
/// An output formatter that specializes in writing JSON content.
///
- ///
- /// The class filter the collection of
- /// and use only those of type
- /// .
- ///
- /// To create a custom formatter that can be used by , derive from
- /// .
- ///
public class JsonOutputFormatter : OutputFormatter
{
private JsonSerializerSettings _serializerSettings;
@@ -66,7 +57,12 @@ namespace Microsoft.AspNet.Mvc
}
}
- private JsonWriter CreateJsonWriter(TextWriter writer)
+ ///
+ /// Called during serialization to create the .
+ ///
+ /// The used to write.
+ /// The used during serialization.
+ protected virtual JsonWriter CreateJsonWriter([NotNull] TextWriter writer)
{
var jsonWriter = new JsonTextWriter(writer);
jsonWriter.CloseOutput = false;
@@ -74,10 +70,13 @@ namespace Microsoft.AspNet.Mvc
return jsonWriter;
}
- private JsonSerializer CreateJsonSerializer()
+ ///
+ /// Called during serialization to create the .
+ ///
+ /// The used during serialization and deserialization.
+ protected virtual JsonSerializer CreateJsonSerializer()
{
- var jsonSerializer = JsonSerializer.Create(_serializerSettings);
- return jsonSerializer;
+ return JsonSerializer.Create(SerializerSettings);
}
public override Task WriteResponseBodyAsync(OutputFormatterContext context)