use serialize/deserialize technique for deepcopy of json objects - fixes some cases where arrays get shallow copied instead