[tekwalk] console and json

tekwalk.blogspot.com [12/Apr/2013]

http://tekwalk.blogspot.in/2013/04/console-and-json.html

recently Alan posted a very nice aticle around prettifying json, reminded me of <this draft>… he posted 2 out of 3 utilities I was gonna mention… so here is 3rd and the shell profile way to use first 2

$ sudo wget -c -O /etc/profile.d/a.json.sh https://raw.github.com/abhishekkr/tux-svc-mux/master/shell_profile/a.json.sh

it contains 2 functions available at shell

# usage example:
# $ json_me ‘echo {“a”: 1, “b”: 2}’
# $ json_me ‘curl http://127.0.0.1/my.json&#8217;
json_me(){
bash -c $@ | python -mjson.tool
}

# requirement: $ pip install pjson
# usage example:
# $ pjson_me ‘echo {“a”: 1, “b”: 2}’
# $ pjson_me ‘curl http://127.0.0.1/my.json&#8217;
pjson_me(){
bash -c $@ | pjson
}

…click here to read full post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: