libmir / mir-ion

Ion, JSON, YAML, CSV, CBOR and Msgpack serialization framework
Apache License 2.0
14 stars 6 forks source link

ion2json not working #17

Closed WebFreak001 closed 2 years ago

WebFreak001 commented 2 years ago

I'm trying to get a JSON representation of IonDescribedValue like so:

IonException deserializeFromIon(scope const char[][] symbolTable, IonDescribedValue v)
{
    import mir.ion.value;
    import mir.ion.conv;

    rawJson = ion2json(inputValue.data);
    return null;
}

however this ends in this exception:

mir.ion.exception.IonException@../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/exception.d(284): IonException: unexpected end of data
----------------
../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/stream.d:41 pure @nogc @safe int mir.ion.stream.IonValueStream.opApply(scope int delegate(const(char[])[], mir.ion.value.IonDescribedValue) pure @nogc @safe).__lambda2(mir.ion.exception.IonErrorCode, const(char[])[], mir.ion.value.IonDescribedValue) [0x5596b6b516fc]
../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/stream.d:233 const pure nothrow @nogc scope @trusted int mir.ion.stream.IonValueStream.opApply(scope int delegate(mir.ion.exception.IonErrorCode, const(char[])[], mir.ion.value.IonDescribedValue) pure nothrow @nogc @safe) [0x5596b6b51b6e]
../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/stream.d:247 const pure @nogc scope @trusted int mir.ion.stream.IonValueStream.opApply(scope int delegate(mir.ion.exception.IonErrorCode, const(char[])[], mir.ion.value.IonDescribedValue) pure @nogc @safe) [0x5596b6b51eef]
../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/stream.d:39 const pure @nogc scope @safe int mir.ion.stream.IonValueStream.opApply(scope int delegate(const(char[])[], mir.ion.value.IonDescribedValue) pure @nogc @safe) [0x5596b6b516c2]
../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/stream.d:54 const pure scope @trusted int mir.ion.stream.IonValueStream.opApply(scope int delegate(const(char[])[], mir.ion.value.IonDescribedValue) pure @safe) [0x5596b6b5178b]
../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/stream.d:321 const pure @safe void mir.ion.stream.IonValueStream.serialize!(mir.ser.json.JsonSerializer!("", std.array.Appender!(char[]).Appender).JsonSerializer).serialize(ref mir.ser.json.JsonSerializer!("", std.array.Appender!(char[]).Appender).JsonSerializer) [0x5596b6b4f1ea]
../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/package.d:735 pure @safe void mir.ser.serializeValue!(mir.ser.json.JsonSerializer!("", std.array.Appender!(char[]).Appender).JsonSerializer, mir.ion.stream.IonValueStream).serializeValue(ref mir.ser.json.JsonSerializer!("", std.array.Appender!(char[]).Appender).JsonSerializer, ref mir.ion.stream.IonValueStream) [0x5596b6b4f1b7]
../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d:566 pure @safe void mir.ser.json.serializeJsonPretty!("").serializeJsonPretty!(std.array.Appender!(char[]).Appender, mir.ion.stream.IonValueStream).serializeJsonPretty(ref std.array.Appender!(char[]).Appender, ref mir.ion.stream.IonValueStream, int) [0x5596b6b4f178]
../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d:578 pure @safe immutable(char)[] mir.ser.json.serializeJsonPretty!("").serializeJsonPretty!(mir.ion.stream.IonValueStream).serializeJsonPretty(ref mir.ion.stream.IonValueStream, int) [0x5596b6b4f117]
../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d:378 pure @safe immutable(char)[] mir.ser.json.serializeJson!(mir.ion.stream.IonValueStream).serializeJson(mir.ion.stream.IonValueStream, int) [0x5596b6b4f0ea]
../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/conv.d:183 pure @safe immutable(char)[] mir.ion.conv.ion2json(scope const(ubyte)[]) [0x5596b6b4d514]
source/served/lsp/protocol.d:95 mir.ion.exception.IonException served.lsp.protocol.JsonToken.deserializeFromIon(scope const(char[][]), mir.ion.value.IonDescribedValue) [0x5596b68ed4c7]
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/deser/package.d:479 mir.ion.exception.IonException mir.deser.deserializeValue!(null).deserializeValue!(served.lsp.protocol.JsonToken, 0, false).deserializeValue(mir.deser.DeserializationParams!(0, false).DeserializationParams, ref served.lsp.protocol.JsonToken) [0x5596b691fc30]
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/deser/json.d:107 void mir.deser.json.deserializeJsonImpl!(false).deserializeJsonImpl!(served.lsp.protocol.JsonToken).deserializeJsonImpl(ref served.lsp.protocol.JsonToken, scope const(char)[]) [0x5596b691292c]
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/deser/json.d:50 served.lsp.protocol.JsonToken mir.deser.json.deserializeJsonImpl!(false).deserializeJsonImpl!(served.lsp.protocol.JsonToken).deserializeJsonImpl!().deserializeJsonImpl(scope const(char)[]) [0x5596b69239ab]
source/served/lsp/protocol.d:117 void served.lsp.protocol.__unittest_L100_C1() [0x5596b68ed6b7]
??:? void served.lsp.protocol.__modtest() [0x5596b69f5060]
??:? int core.runtime.runModuleUnitTests().__foreachbody6(object.ModuleInfo*) [0x5596b6b87b8a]
??:? int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*)).__lambda2(immutable(object.ModuleInfo*)) [0x5596b6b613bb]
??:? int rt.minfo.moduleinfos_apply(scope int delegate(immutable(object.ModuleInfo*))).__foreachbody2(ref rt.sections_elf_shared.DSO) [0x5596b6b77eab]
??:? int rt.sections_elf_shared.DSO.opApply(scope int delegate(ref rt.sections_elf_shared.DSO)) [0x5596b6b78463]
??:? int rt.minfo.moduleinfos_apply(scope int delegate(immutable(object.ModuleInfo*))) [0x5596b6b77e39]
??:? int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*)) [0x5596b6b6138d]
??:? runModuleUnitTests [0x5596b6b879d6]
??:? void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int function(char[][])*).runAll() [0x5596b6b73060]
??:? void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x5596b6b72fec]
??:? _d_run_main2 [0x5596b6b72f4d]
??:? _d_run_main [0x5596b6b72ca9]
/usr/include/dlang/dmd/core/internal/entrypoint.d:29 main [0x5596b68c9075]
??:? [0x7f5718ff930f]
??:? __libc_start_main [0x7f5718ff93c0]
??:? _start [0x5596b68c67f4]

when trying to do

assert(deserializeJson!JsonToken(serializeJson(JsonToken("1"))).rawJson == "1");
WebFreak001 commented 2 years ago

similarly trying to call serializeJson on the IonDescribedValue gives this compilation error:

../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(1557,19): Error: no property `putSymbolId` for type `JsonSerializer!("", Appender!(char[]))`, did you mean `mir.ser.json.JsonSerializer!("", Appender!(char[])).JsonSerializer.putSymbol`?
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(516,57): Error: template instance `mir.ion.value.IonSymbolID.serialize!(JsonSerializer!("", Appender!(char[])))` error instantiating
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(551,22):        instantiated from here: `serializeImpl!(JsonSerializer!("", Appender!(char[])))`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/package.d(735,32):        instantiated from here: `serialize!(JsonSerializer!("", Appender!(char[])))`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(566,23):        instantiated from here: `serializeValue!(JsonSerializer!("", Appender!(char[])), IonDescribedValue)`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(578,28):        ... (1 instantiations, -v to show) ...
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(378,34):        instantiated from here: `serializeJsonPretty!(IonDescribedValue)`
source/served/lsp/protocol.d(96,26):        instantiated from here: `serializeJson!(IonDescribedValue)`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(1788,37): Error: template instance `mir.ion.value.IonDescribedValue.serializeDummy!(JsonSerializer!("", Appender!(char[])))` error instantiating
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(528,53):        instantiated from here: `serialize!(JsonSerializer!("", Appender!(char[])))`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(551,22):        instantiated from here: `serializeImpl!(JsonSerializer!("", Appender!(char[])))`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/package.d(735,32):        instantiated from here: `serialize!(JsonSerializer!("", Appender!(char[])))`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(566,23):        ... (2 instantiations, -v to show) ...
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(378,34):        instantiated from here: `serializeJsonPretty!(IonDescribedValue)`
source/served/lsp/protocol.d(96,26):        instantiated from here: `serializeJson!(IonDescribedValue)`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(531,53): Error: template instance `mir.ion.value.IonSexp.serialize!(JsonSerializer!("", Appender!(char[])))` error instantiating
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(551,22):        instantiated from here: `serializeImpl!(JsonSerializer!("", Appender!(char[])))`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/package.d(735,32):        instantiated from here: `serialize!(JsonSerializer!("", Appender!(char[])))`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(566,23):        instantiated from here: `serializeValue!(JsonSerializer!("", Appender!(char[])), IonDescribedValue)`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(578,28):        ... (1 instantiations, -v to show) ...
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(378,34):        instantiated from here: `serializeJsonPretty!(IonDescribedValue)`
source/served/lsp/protocol.d(96,26):        instantiated from here: `serializeJson!(IonDescribedValue)`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(2234,23): Error: no property `putKeyId` for type `JsonSerializer!("", Appender!(char[]))`, did you mean `mir.ser.json.JsonSerializer!("", Appender!(char[])).JsonSerializer.putKey`?
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(534,55): Error: template instance `mir.ion.value.IonStruct.serialize!(JsonSerializer!("", Appender!(char[])))` error instantiating
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(551,22):        instantiated from here: `serializeImpl!(JsonSerializer!("", Appender!(char[])))`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/package.d(735,32):        instantiated from here: `serialize!(JsonSerializer!("", Appender!(char[])))`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(566,23):        instantiated from here: `serializeValue!(JsonSerializer!("", Appender!(char[])), IonDescribedValue)`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(578,28):        ... (1 instantiations, -v to show) ...
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(378,34):        instantiated from here: `serializeJsonPretty!(IonDescribedValue)`
source/served/lsp/protocol.d(96,26):        instantiated from here: `serializeJson!(IonDescribedValue)`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(2814,23): Error: no property `putAnnotationId` for type `JsonSerializer!("", Appender!(char[]))`, did you mean `mir.ser.json.JsonSerializer!("", Appender!(char[])).JsonSerializer.putAnnotation`?
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(2594,34): Error: template instance `mir.ion.value.IonAnnotations.serialize!(JsonSerializer!("", Appender!(char[])))` error instantiating
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(537,66):        instantiated from here: `serialize!(JsonSerializer!("", Appender!(char[])))`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(551,22):        instantiated from here: `serializeImpl!(JsonSerializer!("", Appender!(char[])))`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/package.d(735,32):        instantiated from here: `serialize!(JsonSerializer!("", Appender!(char[])))`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(566,23):        ... (2 instantiations, -v to show) ...
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ser/json.d(378,34):        instantiated from here: `serializeJsonPretty!(IonDescribedValue)`
source/served/lsp/protocol.d(96,26):        instantiated from here: `serializeJson!(IonDescribedValue)`
../../../.dub/packages/mir-ion-1.0.31/mir-ion/source/mir/ion/value.d(487,9): Error: cannot return non-void from `void` function
9il commented 2 years ago

IonDescribedValue isn's supposed to be serializable directly. But you can do serialize it with symbol table:

            static if (__traits(hasMember, serializer, "putKeyId"))
            {
                alias unwrappedSerializer = serializer;
            }
            else
            {
                import mir.ser.unwrap_ids;
                auto unwrappedSerializer = unwrapSymbolIds(serializer,  symbolTable);
            }
            unwrappedSerializer.serilalizeValue(value);
9il commented 2 years ago

BTW, it feels you are doing something wrong.

Could you use JsonAlgebraic instead of JsonToken?

For example, deserializeJson!JsonAlgebraic or deserializeText!JsonAlgebraic (for better JSON error messages).

WebFreak001 commented 2 years ago

ah JsonAlgebraic might be a better option. Can I then later convert the JsonAlgebraic to custom types through mir-ion somehow?

My idea with JsonToken was that it would optimally just be a slice of the source input for minimal overhead, but that didn't really seem possible with how deserialization works.

9il commented 2 years ago

ah JsonAlgebraic might be a better option. Can I then later convert the JsonAlgebraic to custom types through mir-ion somehow?

You would need to write your own recursive constructor in the custom type.

My idea with JsonToken was that it would optimally just be a slice of the source input for minimal overhead, but that didn't really seem possible with how deserialization works.

Yes, it isn't possible. Json is converted to ion and then deserialized. The ion data is located on the stack or allocated using C library functions and scoped buffers.

If you need to read JSON from a file you can use deserializeJsonFile.

In the same time, unlikely you may need to care about performance. It would be very fast anyway.

The fastest way is deserialization of a custom D types directly form json.

For example:

struct S
{
    double[] array;
    string name;
}
auto s = `{"array":[1.0,4.8],"name":"example"}`.deserializeJson!S;
WebFreak001 commented 2 years ago

I'm trying to use mir-ion with JSON-RPC where I basically have a wrapper JSON that contains additional information like method name and request id and then has the params, which are later passed to the proper handler through a custom type.

I feel like wrappers like this should be common enough that it should be somehow possible to have some kind of any type that can be later converted to the actual resolved type. With painlessjson before I simply stored a JSONValue object everywhere where I either didn't want to implement any (de)serialization but still wanted to give the user access to custom fields or to delay (de)serialization for later/earlier.

struct Request
{
    SumType!(string, int) id;
    string method;
    JSONValue params;
}
9il commented 2 years ago

Mir doesn't support JSONValue and SumType, you can use Mir's JsonAlgebraic and Variant instead.

struct Request
{
    import mir.algebraic: Variant;
    import mir.algebraic_alias: JsonAlgebraic; // it is a recursive Variant.
    Variant!(string, int) id;
    string method;
    import mir.serde;
    @serdeOptional @serdeIgnoreDefault
    JsonAlgebraic params;
}
9il commented 2 years ago

Ah, for deserialization please use deserializeDynamicJson - it can handle internal JsonAlgebraic data.

WebFreak001 commented 2 years ago

I've got most things I needed rewritten now, but JsonAlgebraic doesn't seem to work with all strings.

I tried this code:

import std.stdio;

import mir.serde;
import mir.algebraic_alias.json : JsonAlgebraic;
import mir.deser.json : deserializeDynamicJson;

void main()
{
    auto v = deserializeDynamicJson!JsonAlgebraic(`{"a":[1,"world",false,null]}`);
    writeln(v);
}

which crashes at runtime with

mir.ion.exception.IonException@/home/webfreak/dev/serve-d/mir-ion/source/mir/deser/package.d(1230): Unexpected IonTypeCode for Algebraic!(TaggedType!(typeof(null), "null_"), TaggedType!(bool, "boolean"), TaggedType!(StringMap!(This, uint), "object"), TaggedType!(double, "float_"), TaggedType!(long, "integer"), TaggedType!(This[], "array"), TaggedType!(string, "string"))
----------------
/home/webfreak/dev/serve-d/mir-ion/source/mir/deser/ion.d:58 void mir.deser.ion.deserializeIon!(mir.algebraic.Algebraic!(mir.algebraic.TaggedType!(, "null_").TaggedType, mir.algebraic.TaggedType!(bool, "boolean").TaggedType, mir.algebraic.TaggedType!(mir.string_map.StringMap!(mir.algebraic.This, uint).StringMap, "object").TaggedType, mir.algebraic.TaggedType!(double, "float_").TaggedType, mir.algebraic.TaggedType!(long, "integer").TaggedType, mir.algebraic.TaggedType!(mir.algebraic.This[], "array").TaggedType, mir.algebraic.TaggedType!(immutable(char)[], "string").TaggedType).Algebraic, false).deserializeIon!().deserializeIon(ref mir.algebraic.Algebraic!(mir.algebraic.TaggedType!(, "null_").TaggedType, mir.algebraic.TaggedType!(bool, "boolean").TaggedType, mir.algebraic.TaggedType!(mir.string_map.StringMap!(mir.algebraic.This, uint).StringMap, "object").TaggedType, mir.algebraic.TaggedType!(double, "float_").TaggedType, mir.algebraic.TaggedType!(long, "integer").TaggedType, mir.algebraic.TaggedType!(mir.algebraic.This[], "array").TaggedType, mir.algebraic.TaggedType!(immutable(char)[], "string").TaggedType).Algebraic, scope const(char[][]), mir.ion.value.IonDescribedValue) [0x55c4f1866e79]
/home/webfreak/dev/serve-d/mir-ion/source/mir/deser/ion.d:124 int mir.deser.ion.deserializeIon!(mir.algebraic.Algebraic!(mir.algebraic.TaggedType!(, "null_").TaggedType, mir.algebraic.TaggedType!(bool, "boolean").TaggedType, mir.algebraic.TaggedType!(mir.string_map.StringMap!(mir.algebraic.This, uint).StringMap, "object").TaggedType, mir.algebraic.TaggedType!(double, "float_").TaggedType, mir.algebraic.TaggedType!(long, "integer").TaggedType, mir.algebraic.TaggedType!(mir.algebraic.This[], "array").TaggedType, mir.algebraic.TaggedType!(immutable(char)[], "string").TaggedType).Algebraic, false).deserializeIon!().deserializeIon(ref mir.algebraic.Algebraic!(mir.algebraic.TaggedType!(, "null_").TaggedType, mir.algebraic.TaggedType!(bool, "boolean").TaggedType, mir.algebraic.TaggedType!(mir.string_map.StringMap!(mir.algebraic.This, uint).StringMap, "object").TaggedType, mir.algebraic.TaggedType!(double, "float_").TaggedType, mir.algebraic.TaggedType!(long, "integer").TaggedType, mir.algebraic.TaggedType!(mir.algebraic.This[], "array").TaggedType, mir.algebraic.TaggedType!(immutable(char)[], "string").TaggedType).Algebraic, scope const(ubyte)[]).__foreachbody3(const(char[])[], mir.ion.value.IonDescribedValue) [0x55c4f1866d24]
/home/webfreak/dev/serve-d/mir-ion/source/mir/ion/stream.d:42 pure @nogc @safe int mir.ion.stream.IonValueStream.opApply(scope int delegate(const(char[])[], mir.ion.value.IonDescribedValue) pure @nogc @safe).__lambda2(mir.ion.exception.IonErrorCode, const(char[])[], mir.ion.value.IonDescribedValue) [0x55c4f18a005c]
/home/webfreak/dev/serve-d/mir-ion/source/mir/ion/stream.d:233 const pure nothrow @nogc scope @trusted int mir.ion.stream.IonValueStream.opApply(scope int delegate(mir.ion.exception.IonErrorCode, const(char[])[], mir.ion.value.IonDescribedValue) pure nothrow @nogc @safe) [0x55c4f18a04a2]
/home/webfreak/dev/serve-d/mir-ion/source/mir/ion/stream.d:247 const pure @nogc scope @trusted int mir.ion.stream.IonValueStream.opApply(scope int delegate(mir.ion.exception.IonErrorCode, const(char[])[], mir.ion.value.IonDescribedValue) pure @nogc @safe) [0x55c4f18a0823]
/home/webfreak/dev/serve-d/mir-ion/source/mir/ion/stream.d:39 const pure @nogc scope @safe int mir.ion.stream.IonValueStream.opApply(scope int delegate(const(char[])[], mir.ion.value.IonDescribedValue) pure @nogc @safe) [0x55c4f189fff6]
/home/webfreak/dev/serve-d/mir-ion/source/mir/ion/stream.d:79 const scope int mir.ion.stream.IonValueStream.opApply(scope int delegate(const(char[])[], mir.ion.value.IonDescribedValue)) [0x55c4f18a01af]
/home/webfreak/dev/serve-d/mir-ion/source/mir/deser/ion.d:122 void mir.deser.ion.deserializeIon!(mir.algebraic.Algebraic!(mir.algebraic.TaggedType!(, "null_").TaggedType, mir.algebraic.TaggedType!(bool, "boolean").TaggedType, mir.algebraic.TaggedType!(mir.string_map.StringMap!(mir.algebraic.This, uint).StringMap, "object").TaggedType, mir.algebraic.TaggedType!(double, "float_").TaggedType, mir.algebraic.TaggedType!(long, "integer").TaggedType, mir.algebraic.TaggedType!(mir.algebraic.This[], "array").TaggedType, mir.algebraic.TaggedType!(immutable(char)[], "string").TaggedType).Algebraic, false).deserializeIon!().deserializeIon(ref mir.algebraic.Algebraic!(mir.algebraic.TaggedType!(, "null_").TaggedType, mir.algebraic.TaggedType!(bool, "boolean").TaggedType, mir.algebraic.TaggedType!(mir.string_map.StringMap!(mir.algebraic.This, uint).StringMap, "object").TaggedType, mir.algebraic.TaggedType!(double, "float_").TaggedType, mir.algebraic.TaggedType!(long, "integer").TaggedType, mir.algebraic.TaggedType!(mir.algebraic.This[], "array").TaggedType, mir.algebraic.TaggedType!(immutable(char)[], "string").TaggedType).Algebraic, scope const(ubyte)[]) [0x55c4f1866cc9]
/home/webfreak/dev/serve-d/mir-ion/source/mir/deser/json.d:417 void mir.deser.json.deserializeDynamicJson!(mir.algebraic.Algebraic!(mir.algebraic.TaggedType!(, "null_").TaggedType, mir.algebraic.TaggedType!(bool, "boolean").TaggedType, mir.algebraic.TaggedType!(mir.string_map.StringMap!(mir.algebraic.This, uint).StringMap, "object").TaggedType, mir.algebraic.TaggedType!(double, "float_").TaggedType, mir.algebraic.TaggedType!(long, "integer").TaggedType, mir.algebraic.TaggedType!(mir.algebraic.This[], "array").TaggedType, mir.algebraic.TaggedType!(immutable(char)[], "string").TaggedType).Algebraic).deserializeDynamicJson(ref mir.algebraic.Algebraic!(mir.algebraic.TaggedType!(, "null_").TaggedType, mir.algebraic.TaggedType!(bool, "boolean").TaggedType, mir.algebraic.TaggedType!(mir.string_map.StringMap!(mir.algebraic.This, uint).StringMap, "object").TaggedType, mir.algebraic.TaggedType!(double, "float_").TaggedType, mir.algebraic.TaggedType!(long, "integer").TaggedType, mir.algebraic.TaggedType!(mir.algebraic.This[], "array").TaggedType, mir.algebraic.TaggedType!(immutable(char)[], "string").TaggedType).Algebraic, scope const(char)[]) [0x55c4f1866c86]
/home/webfreak/dev/serve-d/mir-ion/source/mir/deser/json.d:408 mir.algebraic.Algebraic!(mir.algebraic.TaggedType!(, "null_").TaggedType, mir.algebraic.TaggedType!(bool, "boolean").TaggedType, mir.algebraic.TaggedType!(mir.string_map.StringMap!(mir.algebraic.This, uint).StringMap, "object").TaggedType, mir.algebraic.TaggedType!(double, "float_").TaggedType, mir.algebraic.TaggedType!(long, "integer").TaggedType, mir.algebraic.TaggedType!(mir.algebraic.This[], "array").TaggedType, mir.algebraic.TaggedType!(immutable(char)[], "string").TaggedType).Algebraic mir.deser.json.deserializeDynamicJson!(mir.algebraic.Algebraic!(mir.algebraic.TaggedType!(, "null_").TaggedType, mir.algebraic.TaggedType!(bool, "boolean").TaggedType, mir.algebraic.TaggedType!(mir.string_map.StringMap!(mir.algebraic.This, uint).StringMap, "object").TaggedType, mir.algebraic.TaggedType!(double, "float_").TaggedType, mir.algebraic.TaggedType!(long, "integer").TaggedType, mir.algebraic.TaggedType!(mir.algebraic.This[], "array").TaggedType, mir.algebraic.TaggedType!(immutable(char)[], "string").TaggedType).Algebraic).deserializeDynamicJson(scope const(char)[]) [0x55c4f1866c44]
source/app.d:9 _Dmain [0x55c4f1866958]
9il commented 2 years ago

good catch!

9il commented 2 years ago

Fixed in v1.0.41

9il commented 2 years ago

btw, deserializeJson should understand now that JsonAlgebraic is a dynamic type.