JSON Array to SQL IN Statement

Paste a JSON array — plain strings or numbers, or an array of objects — and get a SQL IN clause with values quoted, escaped, deduplicated and chunked for Oracle's 1000-item limit.

json-to-sql-in · runs locally
0Values used
0Duplicates removed
0Skipped
0Chunks

From API response to IN clause

You have a JSON array — an API response, a log extract, a config file — and you need to look those records up in the database. This tool takes the array and produces col IN ('a', 'b', 'c') directly. It accepts plain arrays like ["a", "b"] or [1, 2, 3], arrays of objects (pick which key to extract), and the common {"ids": […]} wrapper with a single array property. Values are escaped, deduplicated and optionally chunked; nested objects, arrays and nulls are skipped with a count — you will never see [object Object] in your SQL.

If your list lives in a spreadsheet rather than JSON, the CSV to SQL IN Statement tool does the same job for CSV columns.

How to convert a JSON array to SQL

  1. Paste the JSON array. Parse errors show immediately, with the position where parsing failed.
  2. For arrays of objects, choose the key to extract from the dropdown.
  3. Adjust quoting, dedupe, the optional column name and chunk size.
  4. Copy the SQL — it updates live as you type.

Why the details matter

A hand-built IN list fails in predictable ways: an unescaped apostrophe in a name breaks the statement, quoted numbers against an integer column dodge the index, and Oracle rejects any list past 1000 items with ORA-01795. The options here exist to head off exactly those failures — auto quoting matches the value type, and the 1000 chunk setting splits long lists into multiple IN groups joined with OR. For genuinely huge lists, consider loading the values into a temp table instead. And if the JSON itself looks mangled, run it through the JSON Formatter first.

Frequently asked questions

Does my JSON leave my browser?

No. Parsing and SQL generation happen entirely on your machine — nothing is uploaded or logged. Since the arrays people paste here tend to come from production APIs full of real IDs and emails, that privacy is the point.

Is the output safe against SQL injection?

Values are escaped with the standard '' doubling, so the clause is well-formed SQL. That said, generated literals are for ad-hoc work — analyst queries, debugging sessions, one-off scripts. In application code, always pass values as parameters instead of splicing them into the query string.

Can I paste an array of objects?

Yes. When the tool detects objects, a key dropdown appears, populated from the keys found across the first 100 objects. Pick the key you want — its value is extracted from every object, and objects missing that key are skipped and counted in the Skipped stat.

How are null values handled?

Nulls are skipped rather than rendered as NULL, because IN never matches NULL anyway — in SQL, col IN (NULL) is not true for any row, even rows where the column is null. If you need to catch nulls, add an explicit OR col IS NULL to your query.