Skip to content

msmoiz/json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON

This is a simple command line JSON parser that reads JSON from standard input and prints it out with agreeable formatting. The following snippet demonstrates usage of the tool.

$ echo '{ "hello": "world", "example": [1, 2, 3, true, false, null] }' | json
{
  "hello": "world",
  "example": [
    1,
    2,
    3,
    true,
    false,
    null
  ]
}

Installation

The tool can be downloaded from the Releases page. It can also be installed from source using the Rust toolchain, available here. Once the Rust toolchain is set up, run the following command from within the root directory of this project.

cargo install --path .

Limitations

The parsing functionality is not available as a standalone library, which makes it of little use to other software for the time being. In addition, the parsing is done using unoptimized recursion which will lead to stack overflow in the case of oversized input. Further, the JSON value construct that is returned by the parser is traversable but otherwise not particularly ergonomic to use.