According to the conformance suite, there are a handful of cases for which 
JSON serialization should fail:

  = Duration value in memory is outside of valid range for JSON
  = Timestamp value in memory is outside of valid range for JSON
  = Fieldmask value in memory is not representable in JSON

This would seem to violate one of the stated goals of proto3 — to simplify 
implementations.  In particular, requiring that JSON serialization be able 
to fail requires additional boilerplate for every single call to a JSON 
serialization method.  This seems somewhat burdensome just to handle the 
remote possibility that someone might try to accidentally process a date 
thousands of years from now.  (It’s especially burdensome for those users 
who aren’t actually using any of these types so have to write boilerplate 
error-handling logic that will never be called.)

It would be far simpler to instead truncate Durations and Timestamps to the 
representable range and to redefine Fieldmask to drop unrepresentable 
fields.  This would eliminate a lot of boilerplate from implementations 
(and users) of the JSON code.



You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
For more options, visit

Reply via email to