{
  "openapi": "3.1.0",
  "info": {
    "title": "jsondiff.tools API",
    "version": "1.0.0",
    "summary": "Free semantic JSON comparison.",
    "description": "Compares two JSON values by their data rather than their text. Object key order is ignored and arrays are compared index by index. No API key is required and any origin may call it.",
    "license": {
      "name": "Apache 2.0",
      "identifier": "Apache-2.0"
    }
  },
  "servers": [
    {
      "url": "https://jsondiff.tools"
    }
  ],
  "paths": {
    "/api/json-diff": {
      "post": {
        "operationId": "diffJson",
        "summary": "Compare two JSON values",
        "description": "Returns every difference between `left` and `right`. A type mismatch or a missing node is reported once, without listing its descendants. The request body may be at most 1 MB.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiffRequest"
              },
              "example": {
                "left": {
                  "name": "Ada",
                  "age": 41
                },
                "right": {
                  "name": "Ada",
                  "age": "41",
                  "admin": true
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The comparison result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiffResponse"
                },
                "example": {
                  "equal": false,
                  "summary": {
                    "total": 2,
                    "value": 0,
                    "type": 1,
                    "missing": 1
                  },
                  "differences": [
                    {
                      "path": "/age",
                      "type": "type",
                      "left": 41,
                      "right": "41"
                    },
                    {
                      "path": "/admin",
                      "type": "missing",
                      "right": true
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The body is not valid JSON, is not an object, or lacks `left` or `right`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than 1 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DiffRequest": {
        "type": "object",
        "required": [
          "left",
          "right"
        ],
        "properties": {
          "left": {
            "description": "Any JSON value, including null."
          },
          "right": {
            "description": "Any JSON value, including null."
          }
        }
      },
      "DiffResponse": {
        "type": "object",
        "required": [
          "equal",
          "summary",
          "differences"
        ],
        "properties": {
          "equal": {
            "type": "boolean",
            "description": "True when there are no differences."
          },
          "summary": {
            "type": "object",
            "required": [
              "total",
              "value",
              "type",
              "missing"
            ],
            "properties": {
              "total": {
                "type": "integer"
              },
              "value": {
                "type": "integer"
              },
              "type": {
                "type": "integer"
              },
              "missing": {
                "type": "integer"
              }
            }
          },
          "differences": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Difference"
            }
          }
        }
      },
      "Difference": {
        "type": "object",
        "required": [
          "path",
          "type"
        ],
        "properties": {
          "path": {
            "type": "string",
            "description": "JSON Pointer (RFC 6901) to the differing node. The empty string is the document root."
          },
          "type": {
            "type": "string",
            "enum": [
              "value",
              "type",
              "missing"
            ],
            "description": "`value`: same type, different content. `type`: different JSON types. `missing`: present on one side only."
          },
          "left": {
            "description": "The value on the left. Absent when the node is missing on the left."
          },
          "right": {
            "description": "The value on the right. Absent when the node is missing on the right."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid-json",
                  "missing-field",
                  "too-large",
                  "method-not-allowed"
                ]
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
