Extracted JSON client functions into seperate package

Solves #317