Skip to content

Improve toJSON of the CID  #228

Closed
@Gozala

Description

@Gozala

At the moment toJSON returns following fields

https://github.com/multiformats/js-multiformats/blob/master/src/cid.js#L202-L208

Last one is Uint8Array, so when you run JSON.stringify over object containing CID it gets mangled into unreadable mess because bytes are turned into object with each byte in own offset property.

Can we please either do something more useful in toJSON or drop that method entirely so that replacer function passed to JSON.stringify can handle the substitution, which currently does not happen because toJSON() is runs before replacer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions