从json返回对象中删除不必要的字段 [英] Remove unnecessary field from json return object
本文介绍了从json返回对象中删除不必要的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从json返回对象中删除不必要的字段。
ActionContext
配置
ControllerContext
请求
ModelState
解决方案
您可以定义一个包含所请求属性子集的对象(让我们称之为'子对象
'),用接收到的对象初始化它,然后将它序列化('subobject'
)回到JSON
How to Remove unnecessary field from json return object.
ActionContext
Configuration
ControllerContext
Request
ModelState
解决方案
You might define an object containing the requested subset of properties (let's call it 'subobject
'), initialize it with received object and then serialize it ('subobject'
) back toJSON
.
这篇关于从json返回对象中删除不必要的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文