odnoklassniki / one-nio

Unconventional I/O library for Java
Apache License 2.0
648 stars 96 forks source link

Enhancements for Json support. #70

Open avrecko opened 1 year ago

avrecko commented 1 year ago
avrecko commented 1 year ago

Hello, I've made some enhancement for Json support. I think if you do One-Nio Json <-> One-Nio Json some of this is not needed. But if there are 3rd party servers/libraries in between this is needed.

As mentioned in an issue. I can get a long field as String {"foo":"123" or "foo":123} imho this should just work out-of-the-box. Also needing to call constructor in some rare cases. On Linux noticed that I need to add + 10 for unicode to work.

Overall pretty cool code, I found it very logical and easy to change. Let me know if the changes make sense to you.

avrecko commented 1 year ago

@incubos thanks for the feedback, after making the pull request I made some further changes. I'll update this pull request with my latest changes just unsure when.

Pretty impressed with the performance and the low level control.

avrecko commented 1 year ago

@incubos Finally got around to it. Committed the changes. I've also addressed inheritance with @Before annotation.

avrecko commented 1 year ago

@incubos I've added some more features.

Maybe you can do a review?

incubos commented 1 year ago

@avrecko ResponseTest.testResponseJsonNotSerializable() doesn't pass anymore. Could you please look at it?

avrecko commented 1 year ago

Thank you for doing the review.

I've also added support for not serializing default values. I have not yet synced the changes with this branch.

It does look like it makes a lot of sense to split the Json code in a separete JsonSerializer that is also configurable a little bit.

I'll update the code when I can and we can do the review cycle again.