开发者

Return JSON object from WCF

I am working on a wcf.The service will return a serialized JSON object which will include the following structure:

{

'status':{'id':0,'code':1},

'data' : object (data object)

}

Main problem to make this structure is, how 开发者_开发问答to use object(class object) in this JSON structure.

Please somebody guide me how to pass the "class object" in this JSON structure.

Thanks in advance.....


{    
'status':{'id':0,'code':1},    
'data' : object (data object)    
}

'object (data object )' mentioned by you also required to be in valid JSON format. You can provide more information about this object. Tell what you want to save in object. I can provide more details then.
For Example,

{
    "data": {
        "key1": {
            "subKey1": "val1"
        },
        "key2": [
            {
                "subKey1": "subVal1",
                "subKey2": "subVal2"
            }
        ]
    }
}

You should always use JSON Lint to validate the json structure.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜