{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.forms.service.gov.uk/json-submissions/v1/schema",
  "title": "GOV.UK Forms form submission - version 1",
  "type": "object",
  "properties": {
    "form_name": {
      "type": "string"
    },
    "submission_reference": {
      "description": "A reference number generated by GOV.UK Forms for each submission.",
      "type": "string"
    },
    "submitted_at": {
      "description": "The date and time the form was submitted. This value is in Coordinated Universal Time (UTC) and uses the ISO 8601 format (YYYY-MM-DDThh:mm:ss.sssZ).",
      "type": "string",
      "format": "date-time"
    },
    "answers": {
      "description": "An array containing all the answers provided.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "question_text": {
            "type": "string"
          },
          "question_id": {
            "description": "A unique identifier for a question. If you edit or move a question, its identifier will not change.",
            "type": "string"
          },
          "answer_text": {
            "$ref": "#/$defs/stringOrArrayOfStrings",
            "description": "The answer provided. If the question has multiple fields, such as for a UK Address, this will combine them into one string."
          },
          "title": {
            "$ref": "#/$defs/stringOrArrayOfStrings",
            "description": "The title provided in an answer to a name question."
          },
          "first_name": {
            "$ref": "#/$defs/stringOrArrayOfStrings",
            "description": "The first name provided in an answer to a name question."
          },
          "middle_names": {
            "$ref": "#/$defs/stringOrArrayOfStrings",
            "description": "The middle names provided in an answer to a name question."
          },
          "last_name": {
            "$ref": "#/$defs/stringOrArrayOfStrings",
            "description": "The last name provided in an answer to a name question."
          },
          "address1": {
            "$ref": "#/$defs/stringOrArrayOfStrings",
            "description": "The first line of an address provided in an answer to a UK address question."
          },
          "address2": {
            "$ref": "#/$defs/stringOrArrayOfStrings",
            "description": "The second line of an address provided in an answer to a UK address question."
          },
          "town_or_city": {
            "$ref": "#/$defs/stringOrArrayOfStrings",
            "description": "The town or city provided in an answer to a UK address question."
          },
          "county": {
            "$ref": "#/$defs/stringOrArrayOfStrings",
            "description": "The county provided in an answer to a UK address question."
          },
          "postcode": {
            "$ref": "#/$defs/stringOrArrayOfStrings",
            "description": "The postcode provided in an answer to a UK address question."
          },
          "street_address": {
            "$ref": "#/$defs/stringOrArrayOfStrings",
            "description": "The street address provided in an answer to an international address question."
          },
          "country": {
            "$ref": "#/$defs/stringOrArrayOfStrings",
            "description": "The country provided in an answer to an international address question."
          },
          "selections": {
            "description": "An array of selected options from a ‘Selection from a list of options’ question.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "can_have_multiple_answers": {
            "description": "This is only present and has a value of `true` when multiple answers can be provided for a question.",
            "type": "boolean"
          }
        },
        "required": [
          "question_text",
          "question_id",
          "answer_text"
        ]
      }
    }
  },
  "$defs": {
    "stringOrArrayOfStrings": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ]
    }
  }
}
