从我的ASP返回的Json数据。NET core服务器具有:
JsonConvert.SerializeObject(categories.Select(t => new { id = t.Id.ToString(), text = t.Name.ToLower() }))
看:
[
{
"id": "7929d7ad-c7c3-45c5-b749-7633a478d55c",
"text": "apparel"
},
{
"id": "e551cbc2-9069-4c99-a66b-5824ec2610b2",
"text": "electronics"
}]
但我想要的结果是:
{"results":[
{
"id": "7929d7ad-c7c3-45c5-b749-7633a478d55c",
"text": "apparel"
},
{
"id": "e551cbc2-9069-4c99-a66b-5824ec2610b2",
"text": "electronics"
}]}
选择2。我如何才能做到这一点?