ContentBody.fromJson constructor

ContentBody.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory ContentBody.fromJson(Map<String, Object?> json) {
  return ContentBody(
    value: json[r'value'] as String? ?? '',
    representation: ContentBodyRepresentation.fromValue(
        json[r'representation'] as String? ?? ''),
    embeddedContent: (json[r'embeddedContent'] as List<Object?>?)
            ?.map((i) => EmbeddedContent.fromJson(
                i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    webresource: json[r'webresource'] != null
        ? WebResourceDependencies.fromJson(
            json[r'webresource']! as Map<String, Object?>)
        : null,
    mediaToken: json[r'mediaToken'] != null
        ? ContentBodyMediaToken.fromJson(
            json[r'mediaToken']! as Map<String, Object?>)
        : null,
    expandable: json[r'_expandable'] != null
        ? ContentBodyExpandable.fromJson(
            json[r'_expandable']! as Map<String, Object?>)
        : null,
    links: json[r'_links'] != null
        ? GenericLinks.fromJson(json[r'_links']! as Map<String, Object?>)
        : null,
  );
}