json-split-aom

Crates.iojson-split-aom
lib.rsjson-split-aom
version0.2.0
sourcesrc
created_at2023-09-15 18:10:25.586565
updated_at2024-10-24 20:09:39.17646
descriptionSplit a large JSON file containing an array of maps into multiple files
homepage
repositoryhttps://github.com/qtfkwk/json-split-aom
max_upload_size
id973855
size19,486
(qtfkwk)

documentation

README

Usage

$ json-split-aom -h
Split a large JSON file containing an array of maps into multiple files

Usage: json-split-aom [OPTIONS] -a <JSON_PATH> -i <JSON_PATH> [FILES]...

Arguments:
  [FILES]...  Input file(s)

Options:
  -a <JSON_PATH>      Dotted JSON path to an array in the input file
  -i <JSON_PATH>      Dotted JSON path to the ID in the array element
  -p                  Pretty print output files
  -c                  Allow ID path collisions; still gives warnings but
                      duplicates will overwrite previous files
  -h, --help          Print help
  -V, --version       Print version

---

# Assumptions

* The JSON dotted path keys for array and ID don't have periods.

# Examples
    
1. Use `json-split-aom -a 'Apple.Banana' -i 'id' file.json` to extract objects
   to files named `Apple.Banana-id-ID.json` given a `file.json` with content:
   `{"Apple":{"Banana":[{"id":12,...},...]}}`

2. Use `json-split-aom -a 'Apple' -i 'Banana.id' file.json` to extract objects
   to files named `Apple-Banana.id-ID.json` given a `file.json` with content:
   `{"Apple":[{"Banana":{"id":12,...}},...]}`

3. Use `json-split-aom -a 'Apple.Banana' -i 'Cherry.id' file.json` to extract
   objects to files named `Apple.Banana-Cherry.id-ID.json` given a `file.json`
   with content: `{"Apple":{"Banana":[{"Cherry":{"id":12,...},...}]}}`
$ json-split-aom -V
json-split-aom 0.2.0
Commit count: 4

cargo fmt