# Generate JSON Schema from Sample JSON

**Use case:** 

Create a draft-07 JSON Schema from sample user profile objects, including nested address fields and optional properties.

## Input

```json
{
  "samples": [
    {
      "id": 1,
      "name": "Alice",
      "email": "alice@example.com",
      "active": true,
      "address": {
        "city": "New York",
        "zip": "10001"
      }
    },
    {
      "id": 2,
      "name": "Bob",
      "email": "bob@example.com",
      "active": false,
      "address": {
        "city": "London"
      }
    }
  ],
  "schemaTitle": "UserProfile",
  "schemaDescription": "Schema for user profile records.",
  "outputFormat": "json",
  "inferRequired": true,
  "allowAdditionalProperties": true,
  "mergeAllSamples": true
}
```

## Output

```json
{
  "sampleIndex": {
    "label": "Sample #",
    "format": "number"
  },
  "schemaTitle": {
    "label": "Title",
    "format": "text"
  },
  "fieldCount": {
    "label": "Fields",
    "format": "number"
  },
  "requiredCount": {
    "label": "Required",
    "format": "number"
  },
  "outputFormat": {
    "label": "Format",
    "format": "text"
  },
  "schema": {
    "label": "Schema",
    "format": "text"
  }
}
```

## About this Actor

This example demonstrates how to use [JSON Schema Generator](https://apify.com/automation-lab/json-schema-generator) with a specific input configuration. Visit the [Actor detail page](https://apify.com/automation-lab/json-schema-generator) to learn more, explore other use cases, and run it yourself.