Creating JSON Schemas

You can create JSON schemas using this procedure.

Alternatively, you can create a JSON schema by deriving it from a JSON string sample (often made available by the documentation for the REST service).See Creating JSON schema from a JSON sample.

A JSON schema declares the types and properties of the complex types used for request / response payload data when invoking REST service methods.

Each JSON schema contains a single root complex type (as displayed on the left hand side tree of the editor). Child properties can be added to this type (on left hand side or right hand side). New child complex types can be added to the right hand side tree.

Procedure

  1. Select New > New JSON Schema from a REST services project.
  2. Add Properties to the root JSON object (in the left or right hand side tree control).
  3. Create and use child types for properties of a complex type in right hand side tree.
  4. On the General tab on the Properties view for a JSON Object Type, edit the property types (which are 'Text' by default). Alternatively you can drag-drop types onto properties in the main editor. You can also move properties around using drag drop or the controls provided.
    For services that require or return arrays, check Array.

    The result will look similar to the following example.

    Note: You can also create schemas by importing IETF JSON Schema files (as defined at http://json-schema.org/).