-
Notifications
You must be signed in to change notification settings - Fork 33
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
Provide a from_dict
method
#152
Comments
Effective duplicate of #151 lumping in under that. |
The message constructor allows just passing in a dict; it already does all the heavy lifting. class Squid(proto.message):
mass_kg = proto.Field(proto.INT32, number=1)
s = Squid({"mass_kg": 20}) |
Does this work with nested message? I recall in the monolith it didn't work the same as the parse from dict method. |
@tswast It should work. This is what allows |
That constructor is incompatible with This works:
This does not work:
|
Similar to #151, it would be quite useful to be able to parse a message from a JSON-representation dictionary.
Currently, in https://github.com/googleapis/python-bigquery/pull/332/files we need to deserialize the response to a dictionary because of how the handwritten clients are structured, but then immediately re-serialize the response to a JSON string so that we can call
from_json
.The text was updated successfully, but these errors were encountered: