> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# appmixer.utils.ai.TransformTextToJSON

- Component: `appmixer.utils.ai.TransformTextToJSON`
- Kind: Action
- Version: 1.0.0
- Visibility: Public
- Connector: [appmixer.utils.ai 1.1.4](https://connectors.appmixer.com/connector/appmixer.utils.ai/1.1.4.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.utils.ai/1.1.4/component/appmixer.utils.ai.TransformTextToJSON>

Extract structured JSON data from text using AI.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Text (`text`) | textarea | The text from which to extract structured JSON data. Example: `John is 25 years old.`. |
| Output JSON Schema (`jsonSchema`) | textarea | The schema that defines the structure of the output JSON. Use [JSON Schema format](https://json-schema.org/). Example: `{"type":"object","properties":{"name":{"type":"string"}, "age":{"type":"number"}}}`. It must be a valid JSON schema and must be of "type": "object". If you want to produce an array, you can nest the array under an object property of type array. Example: `{"type":"object","properties":{"contacts":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"age":{"type":"number"}}}}}}`. |

## Output ports

### Port `out`

Variables are loaded dynamically from `/component/appmixer/utils/ai/TransformTextToJSON?outPort=out`.

## Full metadata (component.json)

```json
{
  "name": "appmixer.utils.ai.TransformTextToJSON",
  "author": "Appmixer <info@appmixer.com>",
  "description": "Extract structured JSON data from text using AI.",
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "jsonSchema": {
            "type": "string"
          }
        },
        "required": [
          "text",
          "jsonSchema"
        ]
      },
      "inspector": {
        "inputs": {
          "text": {
            "label": "Text",
            "type": "textarea",
            "index": 1,
            "tooltip": "The text from which to extract structured JSON data. Example: <code>John is 25 years old.</code>."
          },
          "jsonSchema": {
            "label": "Output JSON Schema",
            "type": "textarea",
            "index": 2,
            "tooltip": "The schema that defines the structure of the output JSON. Use <a target=\"blank\" href=\"https://json-schema.org/\">JSON Schema format</a>. Example: <code>{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"}, \"age\":{\"type\":\"number\"}}}</code>. It must be a valid JSON schema and must be of \"type\": \"object\". If you want to produce an array, you can nest the array under an object property of type array. Example: <code>{\"type\":\"object\",\"properties\":{\"contacts\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"age\":{\"type\":\"number\"}}}}}}</code>."
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "out",
      "source": {
        "url": "/component/appmixer/utils/ai/TransformTextToJSON?outPort=out",
        "data": {
          "properties": {
            "generateOutputPortOptions": true
          },
          "messages": {
            "in/text": "dummy",
            "in/jsonSchema": "inputs/in/jsonSchema"
          }
        }
      }
    }
  ],
  "icon": "(data URI omitted)"
}
```
