locked
What if I want to hide "__metadata" from my JSON results? RRS feed

  • Question

  • In order to compact the results of the JSON view of data, I'd like the option of removing the "metadata" property. Is this something that will be possible? Is there a way for me to control the results before it's sent down to the client?
    Friday, April 4, 2008 3:11 AM

Answers

  • Currently there seems to no way of doing this today. We are thinking of making the formatter api's public in the next version and hopefully you should be able to do something like this.

     

    Thanks

    Pratik

    Friday, April 4, 2008 4:03 PM
    Moderator
  • Note: __metadata is our vehicle for transfering type information and the canonical URI for the result.  If we were to allow removing this that would mean inheritance support (and containment - a feature to come in future) would not be supported/possible

     

    Friday, April 4, 2008 7:53 PM

All replies

  • Currently there seems to no way of doing this today. We are thinking of making the formatter api's public in the next version and hopefully you should be able to do something like this.

     

    Thanks

    Pratik

    Friday, April 4, 2008 4:03 PM
    Moderator
  • That would be perfect. The JSON is pretty clean, but there are instances where I need to store the results at a 3rd party location and the size of that storage is very small.
    Friday, April 4, 2008 4:45 PM
  • Note: __metadata is our vehicle for transfering type information and the canonical URI for the result.  If we were to allow removing this that would mean inheritance support (and containment - a feature to come in future) would not be supported/possible

     

    Friday, April 4, 2008 7:53 PM
  • I'm definitely not suggesting removing it all together. This would be a very unique case (for a specific single service method) and something I'd want to do just before the response is sent to the client.
    Friday, April 4, 2008 8:09 PM