Updated the update function

I have moved the Json into a sub function  _Json() so it can be used for create/update accordingly