JairusSW / as-json

The only JSON library you'll need for AssemblyScript. SIMD enabled
MIT License
80 stars 16 forks source link

Support Variant type from as-variant #64

Closed mattjohnsonpint closed 5 months ago

mattjohnsonpint commented 8 months ago

The as-variant library is a dependency:

https://github.com/JairusSW/as-json/blob/49158541030dc90358ccfb02f01980453f8205bf/package.json#L46-L50

But it's not used in any code. An attempt to serialize a variant:

const v = Variant.from(123);
const s = JSON.stringify(v);

fails with: Could not serialize data of type Variant. Make sure to add the correct decorators to classes.

Which of course, we can't do because it's an external library.

@JairusSW - Given your comment in https://github.com/JairusSW/as-json/issues/49#issuecomment-1772170355, can you please look in to adding support for variants so they work?

Thanks.

JairusSW commented 8 months ago

Yeah, that'll be coming in the next big release. I'll start pushing out my local changes to the devlop branch

JairusSW commented 5 months ago

Supporting JSON.Value instead. You can view the implementation here: https://github.com/JairusSW/as-json/blob/master/assembly/index.ts#L52