Extracted JSON client functions into seperate package

Solves #317 
Should we pass dial to `newClient` too?