diff --git a/packages/types-codec/src/native/Json.ts b/packages/types-codec/src/native/Json.ts index 699f2a2152..93a72b7fbb 100644 --- a/packages/types-codec/src/native/Json.ts +++ b/packages/types-codec/src/native/Json.ts @@ -88,11 +88,11 @@ export class Json extends Map implements Codec { } /** - * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information + * @description Converts the Object to a human-friendly JSON, with additional fields, expansion and formatting of information */ public toHuman (): Record { return [...this.entries()].reduce>((json, [key, value]): Record => { - json[key] = isFunction((value as Codec).toHuman) + json[key] = isFunction((value as Codec)?.toHuman) ? (value as Codec).toHuman() : value as AnyJson;