Toolvist

Conversor de JSON a SQL

Convierte arrays JSON en sentencias SQL INSERT o en un esquema CREATE TABLE. Conversor JSON a SQL que infiere los tipos de columna de tus datos.

Paste an array of objects.

Listo para ejecutar.

Records

0

Columnas

0

Sentencias

0

Forma

—

Conversor de JSON a SQL

Convierte un array JSON de registros en sentencias SQL INSERT, con un CREATE TABLE opcional. Los objetos anidados se aplanan en nombres de columna separados por puntos para que nada se pierda en silencio.

The related converters are the CSV to SQL Converter and the SQL to CSV Converter, with the document form handled by the JSON to CSV Converter. To validate the source structure first, the JSON Validator reads it.

Cómo usar JSON a SQL

  1. 1 Paste the JSON array.
  2. 2 Set the table name and confirm the column mapping.
  3. 3 Choose the dialect and the batch size.
  4. 4 Copy the generated statements.

Cómo usarlo

Pega un array JSON de objetos (una típica respuesta de API) y el conversor construye la unión de todas las claves de cada registro. Los valores ausentes se vuelven NULL, los objetos anidados se aplanan y los arrays se almacenan como texto JSON.

  • Acepta un array, un objeto individual o un objeto contenedor
  • Unión de claves de todos los registros
  • Objetos anidados aplanados a columnas padre.hijo
  • Tipos de columna inferidos de los valores
  • Salida MySQL, PostgreSQL, SQLite y SQL Server

Preguntas frecuentes

How is a nested object handled?

By flattening or by serialising, and the choice is significant. Flattening into separate columns requires the table to have those columns. Serialising into a JSON column works only where the database supports a JSON type. Neither is universally right, and the input's structure determines which is viable.

Why are my generated statements rejected?

Usually a type mismatch or an unsupported value. A JSON boolean needs conversion to the database's boolean representation, and a null in JSON has to become the SQL null keyword unquoted. Databases differ in how they handle these, which is why the dialect matters.

Should the insert specify columns explicitly?

Yes. An insert that relies on positional order breaks silently when the table definition changes, because the values land in the wrong columns. Naming the columns makes the statement self-describing and turns a schema change into a visible error rather than corrupt data.

Herramientas para desarrolladores relacionadas

Ver todo en Herramientas para desarrolladores →

También te puede interesar

Herramientas de otras categorías que suelen combinarse con JSON a SQL:

Explorar el directorio completo →