Database & SQL tools

PostgreSQL array parserand interval inspector

Paste one raw array or interval value. Inspect its structure without running a database query.

PostgreSQL array parser

Raw PostgreSQL value

JSON report

Values are parsed in this browser; no upload, database connection or network request is made.

Input options

Paste the raw value without SQL quotes or casts. Non-NULL array elements stay strings; interval fields stay separate.

65,536 characters · 10,000 elements · 6 dimensions · seconds: up to 6 decimal places

Dimensions: 2 · elements: 6 · NULL: 1

A PostgreSQL array parser is useful when a driver, log or exported cell gives you braces and escaped quotes instead of a usable array. Splitting that text on commas loses information as soon as an element contains a comma itself.

Use the example to compare a missing value, the text "NULL" and an empty string. For time intervals, choose the output style used by the source database before interpreting signed fields.

Why use this PostgreSQL array parser?

Keep the original array coordinates

This PostgreSQL array parser reports each dimension alongside the nested values. A lower bound of zero or a negative index remains visible in the metadata even though JSON arrays themselves do not carry PostgreSQL subscripts.

Two rows of three array cells retain grouping, with an empty-value marker distinct from quoted text cells

Separate calendar units from clock time

A month is not a fixed number of seconds. The interval result keeps months, days and microseconds in separate fields, including mixed signs, so a calendar duration is not silently replaced with an elapsed-time estimate.

An interval splits into separate calendar-month, calendar-day and precise-clock compartments

Check the details that change the meaning

01

Choose the parser before changing the text

Switch between array and interval in the options below the editors. Switching preserves your input; the example button previews a value for the selected mode and style before replacing anything.

02

Read bounds and signs before exporting

The initial array starts at index zero. Check dimensions and nullCount in the JSON report. For sql_standard, a lone leading minus can apply to the following day and time fields; select the matching style explicitly.

03

Control when a result becomes current

Auto parsing waits 350 ms after your last edit. Turn it off to use the parse button or Ctrl/Cmd+Enter. Edits disable exports immediately; long reports show 100 lines at a time while exports include every line.

Structure and exact values

Nested values, without type guesses

Use Postgres array to JSON for inspecting structure while retaining numeric-looking values such as 001 or a very large integer as strings. A multidimensional array must be rectangular; inconsistent row lengths produce an error instead of padding or flattening.

Quotes and backslashes are parsed together

The array literal scanner recognizes double-quoted elements, escaped quotes, protected delimiters and escaped whitespace. Unquoted NULL becomes JSON null, while quoted or backslash-protected NULL and an empty quoted element remain strings.

Four explicit interval styles

To parse Postgres interval output, choose postgres, postgres_verbose, sql_standard or iso_8601. The parser accepts integer calendar fields and up to six fractional second digits, then uses exact integer arithmetic for the three exported fields.

Accepted syntax and deliberate limits

Paste the inner value, without SQL
Supply {...}, optionally prefixed by bounds, or one interval value. SQL statements, ARRAY constructors, outer single quotes, E-strings, casts and field qualifiers are rejected. There is no database connection, SQL execution, file import or URL fetch.
Structure is checked; element types are not
Comma is the default delimiter; select semicolon for a box-style array. Coordinates must fit PostgreSQL bounds and match the actual shape. Empty nested arrays become a zero-dimensional empty array. Element OIDs, custom delimiters and array_nulls=off are outside this tool.
Interval input is an explicit subset
Use output-like forms for the selected style. Fractional months, days, hours and minutes, infinity, ISO alternative notation, unknown units and unitless nonzero numbers are rejected. Seconds with more than six decimals are rejected instead of rounded. No total-seconds or Temporal conversion is offered.
Bounded input, complete output
A value may contain at most 65,536 JavaScript characters, 10,000 array elements and six dimensions. Interval month/day fields must fit signed 32-bit integers and microseconds signed 64-bit integers. Any failure blocks export; the tool never returns a silently truncated result.

PostgreSQL array parser questions

malformed array literal - PostgreSQL

Usually the literal has an unmatched brace, a missing quote, a trailing delimiter or an extra SQL wrapper. A PostgreSQL array parser can identify the local syntax error and its line and column. Paste the inner brace-delimited value, not the entire INSERT statement, then inspect the highlighted line.

How is a null value/array handled in postgres?

An unquoted and unescaped NULL, in any letter case, becomes JSON null. "NULL" is text and "" is an empty string. The result also counts null elements. A whole SQL NULL is not an array literal here; use {} when you mean an empty array.

Malformed array literal when inserting multidimensional array into PostgreSQL

PostgreSQL requires matching extents for every dimension. {{a,b},{c}} has row lengths of two and one, so it is rejected. This tool does not add a missing cell or flatten the rows. Correct the source data, then check that any declared bounds match the actual shape.

How to make a CSV file with arrays of varchar containing double quotes for PostgreSQL COPY

There can be two escaping layers: the array representation and the outer COPY or CSV field. This tool handles only the raw array layer. Inside a quoted array element, prefix a double quote or backslash with a backslash. Remove the outer CSV/SQL encoding before pasting the value.

Converting PostgreSQL interval to seconds produces wrong values

Calendar months and days are not interchangeable with a fixed elapsed duration. Month lengths vary, and a calendar day can cross a daylight-saving change. This result preserves the three independent buckets instead of applying an assumed conversion; calculate elapsed seconds against actual timestamps when needed.

How to convert an interval like "1 day 01:30:00" into "25:30:00"?

The notation can be reformatted with SQL outside this tool, but doing so merges the day field into hours. Here 1 day and 01:30:00 remain days="1" and microseconds="5400000000". A 25:30:00 time field instead has days="0" and microseconds="91800000000".

Still have a question?

Inspect your next literal

Use the PostgreSQL array parser to inspect the bounds and values, or select an interval style and compare its three fields before exporting JSON.

One literal per run; no automatic repair.