j.q
Read JSON as a table: .j.read loads a document or JSON Lines from a file, a URL or a string, .j.info shows the schema it would use. `select from `:data.json` is the shortest spelling. .j.j and .j.k serialize and parse a value and need no \l pq.
Examples
select from `:https://www.timestored.com/data/sample/price.json where symbol like "*BTC"
select english, ineffective from `:https://www.timestored.com/data/sample/types.json where english like "F*"
`:t.json 0: enlist .j.j ([] a:1 2; b:("x";"y"))
select from `:t.json where a>1
.j.read["[{\"a\":1},{\"a\":2}]";::;::;()!()]Entity Summary
| Entities | Short Description |
|---|---|
| .j.info[source;opts] | The schema .j.read would use, as the dict its types argument takes, without loading the document. |
| .j.read[source;target;types;opts] | Load a JSON document as a table. |
Entity Details
.j.info[source;opts]
The schema .j.read would use, as the dict its types argument takes, without loading the document. A nested column, or one whose values do not share a q type, answers "*". Only sample_size records are read.
| Return: | a dict of column name to type char |
|---|---|
| Parameters: |
|
Examples
.j.info["[{\"a\":1,\"b\":\"x\",\"o\":{\"p\":1}}]";()!()].j.read[source;target;types;opts]
Load a JSON document as a table. An object gives a one-row table, an array of objects one row per object, any other array a single `json column; a scalar or null signals 'type. Numbers keep the form they were written in (1 long, 1.0 float); a quoted number stays text. Records match by name, key order is free, an omitted key is null. Types are inferred from the first sample_size records and then fixed. Nested objects load recursively.
| Parameters: |
|
|---|---|
| throws: |
Examples
.j.read["{\"a\":1}\n{\"a\":2}\n";::;::;()!()].j.read["{\"status\":\"OK\",\"results\":[{\"t\":\"2026.01.01\"}]}";::;(enlist `t)!enlist "d";(enlist `path)!enlist `results].j.read["[{\"a\":1}]";`t;::;()!()]