Search code examples
c#jsonasp.net-corepropertiesexceptionhandler

How to remove or hide default property from json output which using default library of asp.net


I've got code on fist screenshot first screenshot, needed to display only this four properties. But when i start using this code i get my 4 properties + 2 unnecessary. Second screenshot(result):second screenshot

I tried to this one, but its not workingfull code with an attempt


Solution

  • use an anonymous type instead of ProblemDetails

    var json= JsonConvert.SerializeObject ( new 
                                      {
                                        Status=....
                                       });