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

Error parsing JSON @1:9: No such field: @type #19895

Open
darkdef opened this issue Jan 7, 2025 · 1 comment
Open

Error parsing JSON @1:9: No such field: @type #19895

darkdef opened this issue Jan 7, 2025 · 1 comment
Assignees

Comments

@darkdef
Copy link

darkdef commented Jan 7, 2025

What version of protobuf and what language are you using?
4.29.2
Language: PHP

What operating system (Linux, Windows, ...) and version? Linux Mint 22 Cinnamon

What runtime / compiler are you using (e.g., python version or gcc version) PHP 8.1.31 / PHP 8.0.30

What did you do?

I have generated class
class CreateSessionResult extends \Google\Protobuf\Internal\Message

// $jsonResult contain: {"@type":"type.googleapis.com/Ydb.Table.CreateSessionResult","sessionId":"my_string"}

$mess = new CreateSessionResult();
$mess->mergeFromJsonString($jsonResult);

What did you expect to see

working code without error

What did you see instead?

Error parsing JSON @1:9: No such field: @type

Anything else we should know about your project / environment

for Any this fixed in #4502

@darkdef darkdef added the untriaged auto added to all issues by default when created. label Jan 7, 2025
@darkdef
Copy link
Author

darkdef commented Jan 7, 2025

with flag $ignore_unknown=true - all work
$mess->mergeFromJsonString($jsonResult, true);

But without ext-protobuf (use package google/protobuf) - flag not needed.

@honglooker honglooker removed the untriaged auto added to all issues by default when created. label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants