I have several webservices working as an API for my database, built in C#, WCF 4, returning json and xml format. Currently they work with specific Typed objects, but i want to be able to return dynamic data. Somewhat like what the Youtube API does, you can send in the "fields" variable, and only get the specified datafields back.
I'm thinking i could probably use the Dynamic type for this somehow, but I havn't used it much and have no idea wher开发者_JS百科e to begin. Ideally if someone could point me to a project where this has been implemented i could learn from there, or if someone has an idea on how to implement this.
You can return IDictionary
. The JSON serializer will pick it up and serialize correctly.
精彩评论