Multi-format Support

1ls automatically detects and parses many data formats.

Supported Formats

FormatDescriptionAuto-detect
JSONStandard JSON
JSON5JSON with comments and trailing commas
YAMLYAML documents
TOMLTOML configuration files
CSVComma-separated values
TSVTab-separated values
XMLXML documents
INIINI configuration files
ENV.env files
NDJSONNewline-delimited JSON (logs)
JavaScriptJS with export default
TypeScriptTS with export default
TextPlain text, line by line

Examples

YAML

bash
echo 'name: John
age: 30
city: NYC' | 1ls '.name'
# Output: "John"

CSV

bash
echo 'name,age
John,30
Jane,25' | 1ls '.map(x => x.name)'
# Output: ["John", "Jane"]

ENV

bash
echo 'DATABASE_URL=postgres://localhost/db
PORT=3000' | 1ls '.PORT'
# Output: 3000

NDJSON (logs)

bash
echo '{"level":"error","msg":"Failed"}
{"level":"info","msg":"Started"}' | 1ls '.filter(x => x.level === "error")'
# Output: [{"level":"error","msg":"Failed"}]

Explicit Format

Use --input-format to specify the format explicitly.

bash
cat data.yaml | 1ls --input-format yaml '.users[0].name'
cat data.csv | 1ls --input-format csv '.filter(x => x.age > 25)'