code: public final static String toJson(Object object, DeIdentify deidentify) {
          if (isPrimitive(object)) {
              Object deidentifiedObj = deidentifyObject(object, deidentify);
              String primitiveValue = String.valueOf(deidentifiedObj);
              if (object instanceof String || object instanceof Character || !object.equals(deidentifiedObj)) {
                  primitiveValue = '"' + primitiveValue + '"';
              }
              return primitiveValue;
          }
          return JSON.toJSONString(object, JsonFilter.INSTANCE);
      }
docs: Converts an object to json.
  
  @param object        an object
  @param deidentify    the deidentify
  @return a json string of the object