Closed casimiro closed 1 year ago
I'm working on pushing out a fix to this now
Implemented in the latest commit (https://github.com/JairusSW/as-json/commit/eb62149198c4b013d9ee1b7b17b5db19d8ff2b0f)
Use JSON.parse<Vec3>("{}", true)
Let me know if this works fine for you Perhaps I can have it pass an actual config object through for more options in the future.
Hello,
I noticed
as-json
doesn't support attributes with default values. Consider the following example:Trying to access
p.c2
will cause the following error:This error can only be observed when trying to access a default-valued attribute that hasn't been overwritten by
JSON.parse
; in the example above,p.c1
is successfully accessed and its value is printed to the standard output.Being able to define default values is especially useful when dealing with user configuration as it allows merging default values with user provided ones quite seamlessly.
Finally, thank you for developing this library!