-
Notifications
You must be signed in to change notification settings - Fork 55
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
Feature request: serialize by class #4
Comments
Serializing an object is basically just calling
Or did you mean something else? |
Closing due to inactivity. Will reopen if really an issue. |
I meant to serialize and rename all parameters, how they're defined by JsonProperty in the class itself |
I don't follow, can you please make an example and explain what you mean? Maybe you mean something similar like #6? |
No. For example: we have some class, described to use JsonConvert. It have 3 params: _id, _name, _age and JsonProperty is set up to deserialize them from id, name and age(without underscores) attributes. It's working like a charm. But I want to SERIALIZE them and in output have properties, that I described by JsonProperties(id, name, age), not original ones(_id, _name, _age) |
Basically you have this scenario: JSON: TypeScript: The deserialization maps _id to id, _name to name and _age to age. Am I correct you would like the serialize() function to map id to _id, name to _name and age to _age again, as it was in the JSON? |
Exactly! |
Ok, I will keep this issue open and put it on my to do list for a future version. |
Thank you! |
Waiting for this enhancement. |
@RAHILKHERA I will work on this after finishing my current project in around 2 weeks! |
@andreas-aeschlimann Thanks a lot. Please comment here whenever it is ready. |
@RAHILKHERA looking forward to this feature as I was curious about it not being implemented myself... as generally in the java world (being a java dev) this is what I was expecting. Thanks and look forward to see the update. |
Adding my request for this feature as well. Coming from the C# world, this was my expected behavior. |
+1 |
+1 please let me know if you used any alternatives to solve it temporarily until this feature is available. This is almost like Jackson libraries in Java world. |
I'll close this as this is implemented now. Will publish the NPM package when the other features are included as well. |
Hi! I really liked this library and just wondered, can we, developers, have slightly improved serialize function, so it can accept a class same way, as deserialize method receives it? Thank you!
The text was updated successfully, but these errors were encountered: