.net core : incomplete JSON response

后端 未结 6 1871
萌比男神i
萌比男神i 2020-12-18 21:08

I\'m trying to build simple API for training, in my database I got users (firstname, lastname, email password, list) and sports ( name, userID). A

6条回答
  •  星月不相逢
    2020-12-18 21:26

    I'm running into the same issue right now. You can also change the JSON serialization/configuration settings to ignore self-reference loops, as shown in the accepted answer for this question

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc().AddJsonOptions(options => {
            options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
        });
    }
    

提交回复
热议问题