deserializeDatum function

dynamic deserializeDatum(
  1. dynamic value,
  2. {Type outputType}
)

Deserializes some JSON-serializable value into a usable Dart value.

Implementation

deserializeDatum(value, {Type outputType}) {
  if (outputType != null) {
    return reflection.deserialize(value, outputType, deserializeDatum);
  } else if (value is List) {
    logger.info("Deserializing this List: $value");
    return value.map(deserializeDatum).toList();
  } else if (value is Map) {
    logger.info("Deserializing this Map: $value");
    Map result = {};
    value.forEach((k, v) {
      result[k] = deserializeDatum(v);
    });
    return result;
  } else if (_isPrimitive(value)) {
    logger.info("Value $value is a primitive");
    return value;
  }
}