eclipse-emfcloud / emfjson-jackson

emfjson-jackson
Other
16 stars 15 forks source link

Json serialization of arrays #31

Closed gg-dim closed 2 years ago

gg-dim commented 2 years ago

I have tried to use a 2 dimensional Double array in our ecore model <eClassifiers xsi:type="ecore:EDataType" name="d2" instanceClassName="java.lang.Double[][]"/> and expected something like: "d2":[[1.1,1.2],[2.1,2.2]] as json but got: "d2":"ACED0005757200145B5B4C6A6176612E6C616E672E446F75626C653BD2F91EFA064A0BB0020000787000000002757200135B4C6A6176612E6C616E672E446F75626C653BE112AD8900A656A6020000787000000002737200106A6176612E6C616E672E446F75626C6580B3C24A296BFB0402000144000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078703FF199999999999A7371007E00043FF33333333333337571007E0002000000027371007E00044000CCCCCCCCCCCD7371007E0004400199999999999A" The same issue occurs with every kind of object array.

As the cause of the problem I have identified a little bit to greedy rawType identification in the EcoreTypeFactory. For the EByteArray type it is fine to handle it as EcoreType.DataType, but for other arrays the serialization should go the usual way and drill down to the component types.

juergen-albert commented 2 years ago

@ghillairet and @martin-fleck-at Not sure who the current project lead here so I just mention the two of you. Is there any chance we get this merged/reviewed soon? Can we support you in any way, shape or form?

martin-fleck-at commented 2 years ago

@juergen-albert Sorry, somehow this must have slipped through the cracks, I will have a look at this later today.

juergen-albert commented 2 years ago

Thanks heaps!