Extracted JSON client functions into seperate package

Solves #317 
This shouldn't need to be a pointer.