> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Convert String To Struct

export const ComponentMetadata = ({warehouses, unsupportedWarehouses = [], componentType, connectionInputs, connectionOutputs}) => {
  const allWarehouses = [...warehouses.map(w => ({
    name: w,
    supported: true
  })), ...unsupportedWarehouses.map(w => ({
    name: w,
    supported: false
  }))];
  return <div style={{
    background: 'var(--colors-background-light, #f9fafb)',
    border: '1px solid var(--colors-border-default, #e5e7eb)',
    borderRadius: '12px',
    padding: '20px 28px',
    marginBottom: '28px',
    boxShadow: '0 1px 4px rgba(0,0,0,0.10)'
  }}>
      <table style={{
    width: '100%',
    borderCollapse: 'collapse'
  }}>
        <tbody>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle',
    width: '180px'
  }}>Project Availability</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>
              <div style={{
    display: 'flex',
    flexWrap: 'wrap',
    gap: '8px'
  }}>
                {allWarehouses.map((w, i) => <span key={i} style={{
    background: w.supported ? '#dcfce7' : '#fee2e2',
    color: w.supported ? '#15803d' : '#b91c1c',
    border: `1px solid ${w.supported ? '#bbf7d0' : '#fca5a5'}`,
    borderRadius: '9999px',
    padding: '3px 12px',
    fontSize: '0.85rem',
    fontWeight: '500',
    whiteSpace: 'nowrap'
  }}>
                    {w.name} {w.supported ? '✅' : '❌'}
                  </span>)}
              </div>
            </td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Component Type</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>{componentType}</td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Connection Inputs</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>{connectionInputs}</td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Connection Outputs</td>
            <td style={{
    verticalAlign: 'middle'
  }}>{connectionOutputs}</td>
          </tr>
        </tbody>
      </table>
    </div>;
};

<ComponentMetadata warehouses={["Databricks"]} unsupportedWarehouses={["Snowflake", "Amazon Redshift"]} componentType="Transformation" connectionInputs="One" connectionOutputs="Unlimited" />

The **Convert String To Struct** transformation component takes JSON format data that is stored as a STRING data type and converts it to a Databricks [STRUCT](https://docs.databricks.com/en/sql/language-manual/data-types/struct-type.html) data type that can then be queried and manipulated.

In SQL terms, this is equivalent to performing a SELECT CAST() operation on the string data.

Although many APIs return JSON data as a string, this isn't typically a useful format for JSON data as transformation components can't directly query or extract individual JSON elements within a string. To address specific elements in a JSON string, you would first need to use Convert String To Struct, and then use a component such as [Extract Structured Data](/docs/components/extract-structured-data).

The component operates on a single selected column from the input dataset, so if the dataset includes multiple columns to be converted you would need multiple instances of Convert String To Struct in the pipeline.

### Use case

Some common uses for this component include:

* Extract fields from JSON strings in an input table. You can't directly access individual items within the string unless you parse the JSON string. Using this component, you convert the string into a structured object, allowing you to reference its elements in downstream components.
* Work with string data returned from an API by a [Custom Connector](/docs/guides/custom-connector-overview). Many APIs will return JSON data in a string format, which must be converted before it can be usefully manipulated.

***

## Properties

<ResponseField name="Name" type="string" required>
  A human-readable name for the component.
</ResponseField>

{/* <!-- param-start:[columnName] | warehouses: [databricks] --> */}

<ResponseField name="Column Name" type="drop-down" required>
  Select an input column that contains the source text.

  The component will operate on only a single column of the input. If you need to extract from multiple columns of a source table, use multiple copies of the Convert String To Struct component.
</ResponseField>

{/* <!-- param-start:[columns.name, columns.datatype, columns.childElements] | warehouses: [databricks] --> */}

<ResponseField name="Columns" type="data structure" required>
  Use this property to define the output structure. The component will attempt to match the elements you define in this structure to elements in the text input. If an element defined here can't match with any part of the input string, that element will be output with a value of `null`.

  The **Columns** dialog shows a graphical representation of the output structure.

  * To add a new element, click the three dots **...** next to the **STRUCT** element at the top of the structure, and then click **Add element**. Each element should be assigned a unique **Key** and a **Type**.
  * To edit an element's Key or Type, click the three dots **...** next to the element and click **Edit element**.
  * To delete an element, click the three dots **...** next to it and click **Delete element**.
  * To remove all elements added to the structure so far, reverting to a blank structure, click **Reset**.

  Click **Save** when you have finished editing and selecting elements.
</ResponseField>

{/* <!-- param-start:[includeInputColumns] | warehouses: [databricks] --> */}

<ResponseField name="Include Input Columns" type="boolean" required>
  Choose whether to include input columns in the output stream.
</ResponseField>
