-
Notifications
You must be signed in to change notification settings - Fork 400
Add serialization support for mutli-dimensional arrays #782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #782 +/- ##
==========================================
- Coverage 63.84% 63.79% -0.06%
==========================================
Files 278 279 +1
Lines 41507 41544 +37
==========================================
Hits 26501 26501
- Misses 15006 15043 +37
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and good job adding the tests!
Just a couple of comments and suggestions for you to consider.
Looks good to me! Nuget is on the way out. Please give it a try. |
@angularsen @trb5016 Out of curiosity, why was functionality added to something marked obsolete?
Works just fine... |
@dschuermans In my project at the time, I believe I was using JsonNet v4.0.0 which did not have UnitsNetIQuantityJsonConverter. So I was still using the old UnitsNetJsonConverter. Then not realizing UnitsNetIQuantityJsonConverter would fix the issue, I went and made my PR despite the UnitsNetJsonConverter being marked obsolete. The real kicker is, when v4.2.0 came out with this change in it, I finally connected the dots and realized that UnitsNetJsonConverter was obsolete , so I changed my project to use UnitsNetIQuantityJsonConverter, and so I'm not even using the fix from this PR... |
Ran into an issue where a 2D (or any mutlidimensional array) would serialize to a 1D array and therefore couldn't be deserialized back to a 2D array based on the UnitsNetJsonConverter implementation.
Years ago in Json.Net multidimensional arrays weren't supported, so the existing Units.Net implementation may have been a result of that (used to have to do nested 1D arrays). However, modern Json.Net can serialize/deserialize mutlidimensional arrays without issue.
Added serialization, deserialization, and compatibility tests for a 2D array. Combined with the existing tests prove the new mutlidimensional array approach doesn't break the 1D arrays (or anything else tested).