Serialization (preferably through json)
See original GitHub issueWhich package is the feature request for?
discord.js
Feature
A way to serialize a reference class and rebuild it on the other side.
Ideal solution or implementation
someFunctionToPassThroughPipe(message.toJSON())
messageRecieved = discord.Message.from(data)
Alternative solutions or implementations
I could do it in my own use case, however I would rather just see it as an official feature rather than a hacky solution that could break on the next update.
Other context
This should have been implemented well before v10.x.x, just saying. It’s a rest api there is nothing critical about any of these data wrappers. Albeit makes it easier to work with in localized projects it gets more complicated when you can’t send the real thing.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Serialize .Net object to json, controlled using xml attributes
I've written a small patch for Json.Net which allows the DefaultContractResolver to work with Xml attributes. It works for the simple example above,...
Read more >Serialization - Optimizely
The Content Delivery API takes your content in the Optimizely database and converts it into JSON format, which is a format that encodes...
Read more >Working with JSON in Apex: A Primer - David Reed
Apex can serialize and deserialize JSON to strongly-typed Apex classes and also to generic collections like Map<String, Object> and List<Object> ...
Read more >Different Serialization Approaches for Java - Baeldung
Learn several approaches for serializing Java objects using third-party ... JSON is preferable due to readability and being schema-less.
Read more >Serialization - Lagom Framework
Akka recommends Jackson-based serializers –preferably JSON but CBOR is also supported– as a good default in most cases. On top of Akka serializers, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The new package,
@discordjs/structures
(implemented by #8417), will implement a way to get an approximate of Discord’s raw data back in thetoJSON()
methods. The idea is to makediscord.js
use those classes and extend them to add the REST methods.I hope that addresses your request @parmleyhunt.
It’ll be approximate because
1.0
becomes1
, and2022-08-10T14:11:23.529000+00:00
becomes2022-08-10T14:11:23.529Z
.Other than that, the data returned by
/structures
is completely valid and near-identical with what Discord sends us.