Skip to content

Emit null when serializing unset Google\Protobuf\Value to JSON in pure-PHP runtime. - #29531

Draft
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_973442012
Draft

Emit null when serializing unset Google\Protobuf\Value to JSON in pure-PHP runtime.#29531
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_973442012

Conversation

@copybara-service

Copy link
Copy Markdown

Emit null when serializing unset Google\Protobuf\Value to JSON in pure-PHP runtime.

Note that this won't perfectly round trip, since on parse-back the null_value arm will be set instead, but the common behavior of other impls is to emit null for this.

Before this fix, the Pure-PHP JSON implementation would emit malformed JSON by emitting no value,, like {"someValueField": }

Note that this actually won't perfectly round-trip (since the parse-back will parse it as a Value with null_value kind). This matches the behavior of our other runtimes.

…ure-PHP runtime.

Note that this won't perfectly round trip, since on parse-back the `null_value` arm will be set instead, but the common behavior of other impls is to emit `null` for this.

Before this fix, the Pure-PHP JSON implementation would emit malformed JSON by emitting no value,, like `{"someValueField": }`

Note that this actually won't perfectly round-trip (since the parse-back will parse it as a Value with null_value kind). This matches the behavior of our other runtimes.

PiperOrigin-RevId: 973442012
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

Successfully merging this pull request may close these issues.

1 participant