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

# insert_records_from_json

### insert\_records\_from\_json

<ul>
  <li>
    insert\_records\_from\_json(\
    &#x20;records: string | Record\<string, any> | Record\<string, any>\[],\
    &#x20;table\_name: string,\
    &#x20;create\_table\_options?: Record\<string, string>,\
    &#x20;options?: Record\<string, string>,\
    &#x20;callback?: [GPUdbCallback](https://docs.kinetica.com/content/api/javascript/types/GPUdbCallback.md),\
    ): Promise\<Record\<string, any>>

    Inserts records supplied as JSON, via `/insert/records/json`.Accepts a single record, an array of records, or a JSON string holding either. The endpoint takes its parameters in the query string rather than the request body, which carries the records themselves.

    #### Parameters

    <ul>
      <li>
        records: string | Record\<string, any> | Record\<string, any>\[]

        A record, an array of records, or a JSON string
      </li>

      <li>
        table\_name: string

        Table to insert into; created if the options say so
      </li>

      <li>
        `Optional`create\_table\_options: Record\<string, string>

        `create_table_options` for the endpoint
      </li>

      <li>
        `Optional`options: Record\<string, string>

        `options` for the endpoint
      </li>

      <li>
        `Optional`callback: [GPUdbCallback](https://docs.kinetica.com/content/api/javascript/types/GPUdbCallback.md)

        Optional callback function
      </li>
    </ul>

    #### Returns Promise\<Record\<string, any>>

    Promise resolving to the insertion counts

    #### Example

    ```
    await gpudb.insert_records_from_json(
        [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }],
        'my_table',
        { type_inference_mode: 'speed' },
        {}
    );
    ```

    <ul>
      <li>Defined in [src/GPUdb.ts:16193](https://github.com/kineticadb/kinetica-api-typescript/blob/master/src/GPUdb.ts#L16193)</li>
    </ul>
  </li>
</ul>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.