Migrated web service to .NET Core 2.0 and returning json

后端 未结 1 514
清歌不尽
清歌不尽 2021-01-07 02:01

I have migrated my web service to .NET Core 2.0, it works fine but I have problem with getting response as json string.

Method on api:

    [HttpGet]
         


        
相关标签:
1条回答
  • 2021-01-07 02:49

    Well it appears that in .NET Core 2.0 [Produces("application/json")] has changed and it is serializing string outputs to json so I had it serialized twice... solution for this os to replace [Produces("application/json")] with [Produces("text/plain")] ovet the method / controller

    0 讨论(0)
提交回复
热议问题