Skip to content

Latest commit

 

History

History
86 lines (60 loc) · 1.47 KB

README.md

File metadata and controls

86 lines (60 loc) · 1.47 KB

TURBO-JSON

turbo-json takes as input a path to JSON files, and combines the valid JSON's in an array written in the standart output.

The memory usage will not exceed 8kb per file as read and write are done in a streaming manner. Resulting in a very low memory usage and fast processing

Example

How JSON files are combined

The input JSON files are combined and output as one JSON array. When it encounters a JSON array as the root type of one of the input file, it will concatenate the array with the final output (see examples below).

Example 1

Input files:

{ "id": 1 } // file 1
{ "id": 2 } // file 2

Output JSON:

[
  { "id": 1 },
  { "id": 2 }
]

Example 2

Input files:

[ 1, 2, 3 ] // file 1
{ "id": 1 } // file 2

Output JSON:

[
  1,
  2,
  3,
  { "id": 1 }
]

Features

  • Read and write of input and output is done in streams.
  • Files JSON's format are validated before combined.
  • Validation of JSON files are multithreaded.

CLI

Installation

cargo install turbo-json

Usage

turbo-json [files ...]

Example

turbo-json tests/misc/**/*.json