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

# Extract JSON from text

> Extracts and parses the first JSON object or array embedded in arbitrary text. **Pro license required.**



## OpenAPI

````yaml /api-reference/utilities/openapi.json post /json/extract
openapi: 3.1.0
info:
  title: Magic Meal Kits — Utilities API
  version: 1.0.0
  description: >-
    Single-purpose helper endpoints: sandboxed JavaScript execution, JSON
    extraction from mixed text, ISO 8601 duration formatting, and Markdown →
    Slack Block Kit conversion.
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
servers:
  - url: https://{deployment}/api/v1
    description: Your Magic Meal Kits deployment
    variables:
      deployment:
        default: magic-meal-kits-xxxxx.run.app
        description: Your Cloud Run host (without protocol)
security:
  - ApiKeyAuth: []
tags:
  - name: JavaScript
    description: Execute JavaScript in a sandbox.
  - name: JSON
    description: Extract JSON from mixed text content.
  - name: ISO 8601
    description: Format and decompose ISO 8601 durations.
  - name: Slack
    description: Convert Markdown to Slack Block Kit.
paths:
  /json/extract:
    post:
      tags:
        - JSON
      summary: Extract JSON from text
      description: >-
        Extracts and parses the first JSON object or array embedded in arbitrary
        text. **Pro license required.**
      operationId: extractJSON
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JSONExtractRequest'
            example:
              text: >-
                Sure! Here is the data: {"name": "manju", "count": 3} — hope
                that helps.
      responses:
        '200':
          description: Extracted JSON (object or array)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONExtractResponse'
              example:
                json: '{"name":"manju","count":3}'
                parsed_json:
                  name: manju
                  count: 3
                is_array: false
        '400':
          description: Invalid request or non-Pro license
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusErrorResponse'
components:
  schemas:
    JSONExtractRequest:
      type: object
      required:
        - text
      properties:
        text:
          type: string
          description: Text that contains an embedded JSON object or array.
    JSONExtractResponse:
      type: object
      properties:
        json:
          type: string
          description: The extracted JSON as a string.
        parsed_json:
          type: object
          description: Parsed object (when not an array).
        parsed_json_array:
          type: array
          items: {}
          description: Parsed array (when `is_array` is true).
        is_array:
          type: boolean
        error:
          type: string
    StatusErrorResponse:
      type: object
      properties:
        status:
          type: string
          example: error
        error:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Your deployment's API key (MMK_API_KEY). Routes that accept OAuth2 also
        allow `Authorization: Bearer <token>`.

````