CLI Usage
Complete reference for all JSSON CLI flags and options.
Basic Syntax
jsson -i <file.jsson> [flags]Transpile Flags
| Flag | Default | Description |
|---|---|---|
-i | (required) | Input JSSON file |
-f | json | Output format: json, yaml, toml, typescript |
-m, --minify | false | Minify output (no whitespace) |
--indent | 2 | Number of spaces for indentation |
-schema | - | Schema file to validate output |
-validate-only | false | Only validate, don't output |
-stream | false | Enable streaming for large datasets |
-stream-threshold | 10000 | Auto-streaming threshold |
-include-merge | keep | Merge strategy: keep, overwrite, error |
Output Formatting
# Default (pretty, 2 spaces)
jsson -i config.jsson
# Minified (no whitespace)
jsson -i config.jsson -m
# Custom indentation (4 spaces)
jsson -i config.jsson --indent 4Output Formats
JSON (Default)
jsson -i config.jsson
jsson -i config.jsson -f jsonYAML
jsson -i config.jsson -f yaml > config.yamlTOML
jsson -i config.jsson -f toml > config.tomlTypeScript
Generates TypeScript with as const and inferred types.
jsson -i config.jsson -f typescript > config.tsSchema Validation
Validate output against JSON Schema:
# Validate and output
jsson -i config.jsson -schema schema.json
# Validate only (no output)
jsson -i config.jsson -schema schema.json -validate-onlyValidation output:
✓ Validation passed against schema
✓ Compiled in 1.2msOn error:
❌ Validation failed against schema (json format):
• $.user.age: expected integer, got string
Got: "25"
Expected: integerStreaming Mode
For large datasets (100k+ items):
# Enable streaming
jsson -i large-data.jsson -stream
# Custom threshold
jsson -i data.jsson -stream-threshold 50000Benefits:
- Memory: ~500MB → under 50MB for 100k items
- Handles millions of items efficiently
Include Merge Strategies
When files have duplicate keys:
# Keep first definition (default)
jsson -i main.jsson -include-merge keep
# Overwrite with later definition
jsson -i main.jsson -include-merge overwrite
# Error on duplicates
jsson -i main.jsson -include-merge errorExamples
Pipe to jq
jsson -i config.jsson | jq '.users[0]'Watch and Rebuild
# With entr (Linux)
ls *.jsson | entr -r jsson -i config.jsson > config.json
# With nodemon
nodemon --ext jsson --exec "jsson -i config.jsson > config.json"CI/CD Integration
# GitHub Actions
- name: Build config
run: |
jsson -i config.jsson -f yaml > config.yaml
jsson -i config.jsson -schema schema.json -validate-onlyMakefile
build:
jsson -i config.jsson > config.json
jsson -i config.jsson -f yaml > config.yaml
validate:
jsson -i config.jsson -schema schema.json -validate-only