Skip to main content
DevTools24

JSON to PostgreSQL Query Builder

Pega datos JSON, selecciona visualmente los campos que necesitas y genera consultas PostgreSQL JSONB al instante. Soporta notación de flecha y funciones de ruta.

PostgreSQL JSONB Operators

->Get JSON object field (returns JSON)
->>Get JSON object field as text
#>Get JSON at path (returns JSON)
#>>Get JSON at path as text
@>Contains (for filtering)
?Key exists check

Cuándo Usar

  • Consultar JSON anidado almacenado en columnas PostgreSQL JSONB
  • Construir consultas de extracción complejas sin memorizar sintaxis
  • Migrar de NoSQL a PostgreSQL con datos JSON
  • Aprender operadores y funciones JSONB de PostgreSQL

Consejos profesionales

  • Usar ->> para extracción de texto (necesario para comparaciones WHERE)
  • El operador -> devuelve JSON, mientras que ->> devuelve texto
  • Los índices GIN funcionan mejor con consultas de contención @>
  • Las funciones de ruta son más legibles para datos profundamente anidados

JSON to PostgreSQL Query Builder - Detalles técnicos

PostgreSQL provides powerful JSONB support for storing and querying JSON data. The -> operator returns JSON, while ->> returns text. For nested paths, use #> and #>> or the jsonb_extract_path functions. This tool helps you build these queries visually without memorizing the syntax.

Alternativa de línea de comandos

-- Arrow notation
SELECT data->'user'->>'name' FROM users;

-- Path function
SELECT jsonb_extract_path_text(data, 'user', 'name') FROM users;

-- Containment query (uses GIN index)
SELECT * FROM users WHERE data @> '{"status": "active"}';

Referencia

Ver especificación oficial