elnabo / json2object

Type safe Haxe/JSON (de)serializer
MIT License
66 stars 17 forks source link

Custom Parsing #66

Closed scottPlusPlus closed 4 years ago

scottPlusPlus commented 4 years ago

Allows custom parsing/writing of Classes or Fields via @:jcustomparse/@:jcustomwrite attributes

Main drive was to allow for parsing Dynamics. Happy to make any changes / address concerns.

elnabo commented 4 years ago

It is a nice idea, thanks for the PR !

Just two little things.

scottPlusPlus commented 4 years ago

I swapped out the traces, great call!

I'm not sure I follow about "test of invalid parsing with a custom parser". If I include an invalid parser that doesn't compile, then the test wouldn't compile either?

elnabo commented 4 years ago

Ok, I'll try to add a test later.

Could you swap the final to var so we can continue to support Haxe 3, before I merge it. I forgot it broke the CI.

scottPlusPlus commented 4 years ago

finals swapped. If you manage to get a test working I'll love to see how you did it.

elnabo commented 4 years ago

Thanks for the changes. I'll try to add a test by the end of the end week with the updated readme

ibilon commented 4 years ago

Thanks for the PR, it's quite a useful feature. I've released json2object 3.8.0, the errors thrown inside a custom parser are now available in parser.errors.