Is there a way to retrieve unknown properties from a data object after creation? #605
Unanswered
jameshulse
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
Mhh I don't think so, why not define all the properties of the API? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We are receiving data from an external API. I have modelled data classes to match some of the fields that we care about, but in some cases there may be extra fields on the response that we haven't added to the constructor.
Is there an existing way to have these other fields be saved to the resulting data instance?
I'll try and give a trivial example. Here is a data object:
And the response that we are receiving from an external API:
{ "knownField": "foo", "unknownField": "bar" }Is it possible to see
unknownFieldwhen I call->toArray()on my data object?Beta Was this translation helpful? Give feedback.
All reactions