This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
Consider changing JsonResult's behavior when you provide a formatter #1370
Closed
Description
This code is a bit of a trap.
var formatter = new JsonOutputFormatter()
{
SerializerSettings = serializerSettings,
};
formatter.SupportedEncodings.Clear();
formatter.SupportedEncodings.Add(encoding);
return new JsonResult(content, formatter);
I new up a formatter, and give it the settings and and encoding a I want for this specific action, and then provide it to JsonResult
. It will be ignored if I have a formatter registered in options that handles json (the default).
It turns out I have no way to specify a settings/formatter/encoding for a result ad-hoc unless I drop down to use objectresult.