Deserializing id back to _id
See original GitHub issueThe serializer has the option to specify an alternate field as the id for a resource. This comes in handy when working with databases (notably MongoDB):
new Serializer("users", { id: "_id" }).serialize(users);
I wonder why the same facility isn’t available for deserialization so that after transport, the id can be properly mapped back to the appropriate field in the model:
new Deserializer({ id: "_id" }).deserialize(users);
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
JSON Deserialization from ID into Object - Stack Overflow
As the answer here (Jackson deserialize JsonIdentityReference (alwaysAsId = true)) states, using a setter deserializer works well and does ...
Read more >Id is different after JSON deserialization
When you use a variable of type Id , salesforce is using the 18 character one (even if you ... the query would...
Read more >CWE-502: Deserialization of Untrusted Data (4.9) - MITRE
Serialization and deserialization refer to the process of taking program-internal object-related data, packaging it in a way that allows the data to be ......
Read more >Serialization in Java - DigitalOcean
When we run above class, we get following output. SubClass read = SubClass{id=10,value=Data,name=Pankaj}. So in this way, we can serialize ...
Read more >Serializing and Deserializing a List with Gson - Baeldung
One common use case is to serialize and deserialize a list of POJOs. Consider the class: public class MyClass { private int id; ......
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 Free
Top 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
I’ve added the support of the id option 😉 FYI, here’s the test:
@jcw- FWIW, I worked around this by manually assigning _id to a new id attribute after deserialization, something like:
This is trivial to do but should ideally be built-in.