Mapping PolicyCenter objects to JSON objects

In defining your REST API, you need to develop a JSON schema that describes how to convert a given PolicyCenter entity object into a JSON object that a REST response returns. The PolicyCenter object can be nearly any data model entity. In creating your JSON mapping file, use the extension mapping.json and prepend the appropriate namespace for your REST configuration files to the file name.

Place any JSON mapping files that you create in the following location in Guidewire Studio:
  • configuration > config > Integration > mappings
Guidewire recommends that you create a sub-folder under the Integration > mappings folder using your company name to store your JSON files. For example, suppose that you create a JSON mapping file named contact-1.0.mapping.json. You then store this file in the following location in Studio:
  • configuration > config > Integration > mappings > mycompany

Important

The JSON mapping schema must directly reflect the JSON API schema. This means that for every property you define on a JSON object in a *.schema.json file, there must an equivalent property for the same JSON object in the associated *.mapping.json file.

The mapping schema

The mapping schema file looks similar to the following JSON definition.

{
  "schemaName": "...",

  "mappers": {

    "Object": {
      "schemaDefinition": "..."

      "root": "..."

      "properties": {
        "propertyOne": {
          "path": "..."
        },
        "propertyTwo": "..." {
          "path": "..."
        }      
      }
    
    }
  
  }

}

The example code inserts spaces for readability. The schema requires the use of the 'schemaName' and 'mappers' element. The use of the 'combine' element is optional. You must supply real values for variables in italic font.