Closed bitbonk closed 4 years ago
Hi, I believe this is currently not supported.
The type needs to be IQuantity
for the converter you used, we also have UnitsNetIComparableJsonConverter
to support IComparable
, but none of these support object
to my knowledge.
You could try the legacy UnitsNetJsonConverter
and see if it helps, but I suspect it doesn't.
If you are willing to do a pull request to add the new converter needed to support object
, then I will happily assist you in getting it merged. Take a look at how the existing converters are implemented, whether it is feasible for you to do. If you do go ahead, please also add some unit tests for it.
Best, Andreas
Nevermind, I just figured it out. In the above code I only pass the serialization setting into the deserialize method but not into the serialize method. If I pass the same settings into both, it works.
Great, thanks for the update!
Describe the bug Serializing and Deserializing of quantities stored in a List
To Reproduce Steps to reproduce the behavior (just an example): Run this tests:
Expected behavior The test passes
Additional context In the above test I am using fluent assertions for the assertions. Because the same class is also used for MessagePack serialization, the property
Quanitities
must be of typeList<object>