You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've run into an issue a few times when parsing JSON data into the statically generated classes, when the fields in the JSON data are named using using the json_name annotation for the field names instead of the normal field names.
the object field currently needs to be named thing instead of my_things.
It would be nice if the alternate naming scheme could be used directly, either through a command line switch or using another method like fromJson() in place of fromObject().
The text was updated successfully, but these errors were encountered:
The option you are looking for is keepCase. It's available in Root.load, parse and pbjs (--keep-case). If it's not specified, fields are converted to camelCase. (Or is there something broken?)
I'm already using --keep-case. Afaict that only, as you indicate, tells it not to convert to camel case. I'm looking for an option to parse in fields where the json_name is different altogether like in my example.
protobuf.js version: 6.8.0
I've run into an issue a few times when parsing JSON data into the statically generated classes, when the fields in the JSON data are named using using the json_name annotation for the field names instead of the normal field names.
For example, if a proto file looks like:
And you are parsing in the object like
the object field currently needs to be named
thing
instead ofmy_things
.It would be nice if the alternate naming scheme could be used directly, either through a command line switch or using another method like fromJson() in place of fromObject().
The text was updated successfully, but these errors were encountered: