def do_merge(field, target, value)

      value = Rufus::Json.dup(value)

      if target.is_a?(Array)
        target.push(value)
      elsif value.is_a?(Hash)
        target.merge!(value)
      else # deal with non Hash
        target[field.split('.').last] = value
      end

      target.delete('~')
      target.delete('~~')
    end
def do_merge(field, target, value)

      value = Rufus::Json.dup(value)

      if target.is_a?(Array)
        target.push(value)
      elsif value.is_a?(Hash)
        target.merge!(value)
      else # deal with non Hash
        target[field.split('.').last] = value
      end

      target.delete('~')
      target.delete('~~')
    end
Used by both _merge_to and _merge_from