Skip to content

Commit 55bb58e

Browse files
deploy: 9daec26
1 parent ca04827 commit 55bb58e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

programming-guides/json/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@
107107
message is converted into the special representation and set as a field with key
108108
&ldquo;value&rdquo;.</p><p>For example, a <code>google.protobuf.Duration</code> that represents 3.1 seconds will be
109109
represented by the string <code>"3.1s"</code> in the special case handling. When that
110-
<code>Duration</code> is packed into an <code>Any</code> it will be serialized as:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>{
111-
</span></span><span style=display:flex><span> &#34;@type&#34;: &#34;type.googleapis.com/google.protobuf.Duration&#34;,
112-
</span></span><span style=display:flex><span> &#34;value&#34;: &#34;3.1s&#34;
113-
</span></span><span style=display:flex><span>}
110+
<code>Duration</code> is packed into an <code>Any</code> it will be serialized as:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
111+
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;@type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;type.googleapis.com/google.protobuf.Duration&#34;</span><span style=color:#000;font-weight:700>,</span>
112+
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;3.1s&#34;</span>
113+
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
114114
</span></span></code></pre></div><p>Message types with special JSON encodings include:</p><ul><li><code>google.protobuf.Any</code></li><li><code>google.protobuf.BoolValue</code></li><li><code>google.protobuf.BytesValue</code></li><li><code>google.protobuf.DoubleValue</code></li><li><code>google.protobuf.Duration</code></li><li><code>google.protobuf.FieldMask</code></li><li><code>google.protobuf.FloatValue</code></li><li><code>google.protobuf.Int32Value</code></li><li><code>google.protobuf.Int64Value</code></li><li><code>google.protobuf.ListValue</code></li><li><code>google.protobuf.StringValue</code></li><li><code>google.protobuf.Struct</code></li><li><code>google.protobuf.Timestamp</code></li><li><code>google.protobuf.UInt32Value</code></li><li><code>google.protobuf.UInt64Value</code></li><li><code>google.protobuf.Value</code></li></ul><p>Note that <code>google.protobuf.Empty</code> is not considered to have any special JSON
115115
mapping; it is simply a normal message that has zero fields. This means the
116116
expected representation of an <code>Empty</code> packed into an <code>Any</code> is <code>{"@type": "type.googleapis.com/google.protobuf.Empty"}</code> and not <code>{"@type": "type.googleapis.com/google.protobuf.Empty", "value": {}}</code>.</p><h2 id=json-wire-safety>ProtoJSON Wire Safety</h2><p>When using ProtoJSON, only some schema changes are safe to make in a distributed

0 commit comments

Comments
 (0)