views:

22

answers:

2

Is there a recognized, recommended, or standard form for representing the structure of JSON? E.g., my service returns a structure, effectively, represented as JSON. How do I describe what my service returns, such that another service can consume that JSON and program to its interface?

+2  A: 

JSON is a very free-form format. If you'd like to read the specifics, see json.org. If you follow that, anyone who says they can parse JSON will be able to create an object from it.

To tell another service that you are returning JSON, you will want to send a HTTP Response header for content-type: Content-Type: application/json

Chacha102
A: 

In addition to what @Chacha102 wrote, while there is not an official schema format for JSON, there is a working draft, as well as other related resources. While you mentioned that validation is not your primary goal, these pointers could still be potentially useful depending on how formal you want to be in communicating your JSON interface.

bmoeskau