title: How to return indented json content from an OData controller in asp core web api?
body: <p>I can retrieve intended json result from normal WebApi using following way.</p>
  
  <pre><code>  services.AddMvc()
           .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
           .AddJsonOptions(x=&gt;
           {
               x.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented;
           });
  </code></pre>
  
  <p>But I cannot find a way to output json like this when using ODataController as opposed to ControllerBase when web api is used. ODataController always sends a minified json.</p>
  
  <pre><code>public class EmployeeController : ODataController
  {
  
      [EnableQuery()]
      public IActionResult Get()
      {
          return Ok(new BOContext().Employees.ToList());
      }
  }
  </code></pre>
  
  <p>Also, startup.cs</p>
  
  <pre><code> public class Startup
      {
          private static IEdmModel GetModel()
          {
              ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
              builder.EntitySet&lt;Employee&gt;("Employee");
              return builder.GetEdmModel();
          }
  
          public Startup(IConfiguration configuration)
          {
              Configuration = configuration;
          }
  
          public IConfiguration Configuration { get; }
  
          // This method gets called by the runtime. Use this method to add services to the container.
          public void ConfigureServices(IServiceCollection services)
          {
  
              services.AddOData();
              services.Configure&lt;CookiePolicyOptions&gt;(options =&gt;
              {
                  // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                  options.CheckConsentNeeded = context =&gt; true;
                  options.MinimumSameSitePolicy = SameSiteMode.None;
              });
  
  
  
              services.AddMvc()
                  .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
                  .AddJsonOptions(x=&gt;
                  {
                      x.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.None;
                  });
          }
  
          // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
          public void Configure(IApplicationBuilder app, IHostingEnvironment env)
          {
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
              }
              else
              {
                  app.UseExceptionHandler("/Home/Error");
              }
  
              app.UseStaticFiles();
              app.UseCookiePolicy();
  
              app.UseMvc(routes =&gt;
              {
                  routes.MapODataServiceRoute("odata", "odata", GetModel());
                  routes.MapRoute(
                      name: "default",
                      template: "{controller=Home}/{action=Index}/{id?}");
  
              });
          }
      }
  </code></pre>
  
  <p>The route is working and I am receiving correct data.</p>
  
  <p>Is there a way to control and output indented json from an OData controller?</p>