Move json functions to separate script file