[英]Exclude Odata metadata and type from JSON
The script below return a JSON from my ODataController 下面的脚本从我的ODataController返回一个JSON
< script > $(document).ready(function() { $.ajax({ url: "http://localhost:37994/odata/EPStructures3/", type: "Get", contentType: 'application/json; charset=utf-8', success: function(data) { //do something..... }, error: function(msg) { alert(msg); } }); }); < /script>
The JSON : JSON:
{ "odata.metadata":"http://localhost:37994/odata/$metadata#EPStructures3","value":[{"eps_level":0,"id":2},{"eps_level":1,"id":3}]}
I want to exclude the metadata and type so the JSON is returned like this: 我想排除元数据并键入,以便像这样返回JSON:
[{"eps_level":0,"id":2},{"eps_level":1,"id":3}]
How can I achieve this? 我该如何实现?
如果在请求中添加“ Accept:application / json; odata.metadata = none”标头,则将尽可能接近您想要的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.