toJson function

String toJson(
  1. dynamic object, {
  2. bool parseString = false,
  3. dynamic expand,
  4. dynamic exclude,
})

Serializes the object to a JSON string.

Parameters:

expand : determines how deep is going to be the serialization and avoids stack overflow produced by cyclical object references. exclude : exclude some attributes. It could be String, Map, or List

Implementation

String toJson(object, {bool parseString = false, expand, exclude}) {
//  _serLog.fine("Start serializing");

  if (!parseString && object is String) return object;

  var result = json.encode(objectToSerializable(object, expand: expand, exclude: exclude));

  _serializedStack.clear();

  return result;
}