-
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
Digging Deeper into properties with objects as values #61
Comments
Of course it's possible, that's the purpose of this library. Please see the examples in the ReadMe, it explains exactly how to nest objects (example with Country and City). |
I do not want to create a new object for this, I simply want to get the string value "My Store" and save it to a variable. I know you can do stuff like |
Sure, but then you have no type checking, which is kind against the idea of this library. But in some cases, it might be helpful to save dynamic objects in a property. Use the |
Thanks for the help. |
No problem. Just to clear things up: The notation |
I would still argue for that feature to be added. |
It would be an interesting feature. Right now it is achievable, but only with a custom mapper. One problem is that this mapping is not bijective. You lose data by deserializing, so I am not sure how to define serialization in that case. |
Seems like supporting serialization would complicate the implementation of this feature by a lot. Why not just throw an exception in case serialization is attemped, or simply just ignore the fields that are annotated as nested? A more elaborate solution could be investigated at a second phase. |
Is there a way to dig down into JSON objects where the value is another object?
With the following JSON I would want to get the storeName property. I would think it would be something like this.
@JsonProperty("store.storeName", String) storeName: string = undefined;
{ 'store': { 'storeName':'My Store', 'storeId': 1 }
Is it possible to do anything like this?
The text was updated successfully, but these errors were encountered: