-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improved json serialization / deserialization #2774
base: develop
Are you sure you want to change the base?
Improved json serialization / deserialization #2774
Conversation
SQUISH object node
Thanks Matt for picking this up 👍 The reason that there is no recursive implementation of Docs: https://mathjs.org/docs/core/serialization.html So right now, I think if you use |
This PR addresses this issue albeit in a slightly different way than was described. Instead of implementing
toObject
andfromObject
I opted to instead:fromObject
function (which I'm callingfromJSON
since I think that makes its purpose more obvious)toJSON
methods on each node type to deeply serialize to JSON.fromJSON
methods on each node type to deeply deserialize from JSONNote I'd be happy to add a generic
toJSON
function as well but I honestly am not sure I see the value when you can always just callnode.toJSON()
, but maybe I'm missing somethingNote @josdejong I wasn't sure if there was a reason these methods didn't work "deeply" before, but it seems to me like they would be most useful this way no?