WebAPI返回xml.json格式简单示例 using System.Net.Http.Formatting; public class TestController : ApiController { public static List<Student> list = new List<Student> { new Student { Name="张三",Age=25,Weight=153.5M }, new Student { Name="
最近要整一些报文测试的事情,可当前项目的请求报文格式却不统一,有XML也有JSON,为了一致性,决定统一用JSON格式处理. xmltodict : Makes working with XML feel like you are working with JSON 1.xml转json import xmltodict import json dic = xmltodict.parse("""<mydocument has="an attribute&quo