Extracted JSON client functions into seperate package

Solves #317 
Can I leave off the { } on the single line if, like in C? (or does that go against the Go style)