as-json icon indicating copy to clipboard operation
as-json copied to clipboard

Support Variant type from as-variant

Open mattjohnsonpint opened this issue 11 months ago • 1 comments

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.

mattjohnsonpint avatar Mar 27 '24 20:03 mattjohnsonpint

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

JairusSW avatar Mar 28 '24 05:03 JairusSW

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

JairusSW avatar Jun 17 '24 23:06 JairusSW