Skip to content
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

Can we make json_format._AnyMessageToJsonObject non-private? #1351

Closed
jgeewax opened this issue Mar 25, 2016 · 6 comments
Closed

Can we make json_format._AnyMessageToJsonObject non-private? #1351

jgeewax opened this issue Mar 25, 2016 · 6 comments

Comments

@jgeewax
Copy link

jgeewax commented Mar 25, 2016

https://github.com/google/protobuf/blob/9240acd179708c3a2ab79508af6fd68efa6f883a/python/google/protobuf/json_format.py#L207

It seems super useful - but keeping it private makes us sad :(

@tseaver
Copy link
Contributor

tseaver commented Mar 25, 2016

While we're at it, the inverse _ConvertAnyMessage would be useful, too.

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Mar 25, 2016

The python json_format API already provides MessageToJson() which converts a proto message to a JSON string. So what you need is a MessageToJsonObject() that converts the message to a JSON object instead of a string. Is this correct?

@haberman @anandolee

@tseaver
Copy link
Contributor

tseaver commented Mar 25, 2016

@xfxyjwf Yes, that is correct: our code right now works around the missing MessageToJsonObject API by re-parsing the serialized string.

@tseaver
Copy link
Contributor

tseaver commented Mar 25, 2016

A putative ConvertAnyMessage API would work from the "object" form, rather than the serialized string.

@tseaver
Copy link
Contributor

tseaver commented May 6, 2016

@xfxyjwf Any decision / motion on this issue?

@anandolee
Copy link
Contributor

I believe it has been supported by

def MessageToDict():
"""Converts protobuf message to a JSON dictionary.

adellahlou pushed a commit to adellahlou/protobuf that referenced this issue Apr 20, 2023
…uffers#1351)

* Add unc paths to isAbsolute regex

* Allow unc paths to be resolved and normalized

* Remove trailing whitespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants