-
Notifications
You must be signed in to change notification settings - Fork 446
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
JSONEncoder now supports correct Vector json serialization #176
base: master
Are you sure you want to change the base?
Conversation
I am afraid to say you have not accounted for all types of vectors. Use |
@WORMSS That's not the best approach, considering a vector can contain any type of object. Chaining together a giant if statement to handle vectors of ints, uints, Numbers, etc is going to get out of control really fast... and you'll always be missing user-defined types. A better way would be to use
|
@brianreavis Actually, Wormss is correct.
The method proposed by Wormss would also be much faster than using |
@IQAndreas Thank you. I think the end of your message got cut off. (Atleast on my screen) @brianreavis Not a giant IF, only 4 (5 including Array). There are only 4 types of Vectors, |
@WORMSS I hit the submit button to early, but went back and edited the message. You were simply too quick to the keyboard. ;) I noticed another problem with the proposed changes, you can't convert a Vector to an Array like this: I modified the Also, what is the standard in case a "non-vector" is passed to the function |
I removed the limit of arrayToString having to accept a Array and had it accept *. Another solution would be to just make a vectorToArray, which is super easy to do, and then send the array via arrayToString. No duplication of code for both types of list that way. |
@IQAndreas @WORMSS There are more than four types of vectors. Try it:
|
@brianreavis That's because the You need to set it to a non-null value for the code to work properly:
|
Snap, you're right! Der, my bad. |
I add support for serialazing Objects that contains Vector properties