code: public static String serializeObject(final Object obj, final int indentWidth,
              final boolean onlySerializePublicFields) {
          return serializeObject(obj, indentWidth, onlySerializePublicFields,
                  new ClassFieldCache(/* resolveTypes = */ false, /* onlySerializePublicFields = */ false));
      }
docs: Recursively serialize an Object (or array, list, map or set of objects) to JSON, skipping transient and final
  fields.
  
  @param obj
  The root object of the object graph to serialize.
  @param indentWidth
  If indentWidth == 0, no prettyprinting indentation is performed, otherwise this specifies the
  number of spaces to indent each level of JSON.
  @param onlySerializePublicFields
  If true, only serialize public fields.
  @return The object graph in JSON form.
  @throws IllegalArgumentException
  If anything goes wrong during serialization.