add hash to json if present

doesn't this leak a global variable?