Skip to content

mlvzk/json-to-sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-to-sh

Fast JSON to Shell parser in Rust

Installation

Download the executable from this repo's Releases page and put it in your $PATH

OR

cargo build --release

Usage

eval $( json-to-sh <some.json )
echo $root_v

The default namespace for variables is root.

{ "v": 5 } outputs root_v="5".

In key names, all characters except 0-9, a-z, A-Z and _ are allowed, illegal characters are skipped.

{ "0vA!@#z": 5 } outputs root_0vAz="5".

Keys and indexes are separated by _ (underscore)

[0, 1, { "x": true }] outputs:

root_0="0"
root_1="1"
root_2_x="true"