Closed GoogleCodeExporter closed 9 years ago
Adding type and version information to JSON objects slightly defeats much of
the motivation of JSON: high signal to noise ratio.
We may consider this but if you really need type safety and versioning you
might be better off with a more complex wire protocol like protobuffers or
thrift.
Original comment by limpbizkit
on 22 Jan 2011 at 2:19
I understand it's not for every use case. My use case is JSON as a document
storage format. So as the code changes, the document schema will evolve and
type and version information (where appropriate) is required to keep the latest
code clean of old schema information.
Original comment by swall...@gmail.com
on 24 Jan 2011 at 3:40
There are security issues with carrying type information in the data, and
trusting it on the receiving end. With Gson, we want to discourage such
potential security holes.
May be you should have an explicit field called type but use that to mean
"type/version of the document" instead of the actual Java type.
Original comment by inder123
on 24 Jan 2011 at 10:25
How about tagging the entity version outside of the JSON data?
For example, web services and API, the version is usually within the URL
For file systems, add the version on the file name (or as part of the directory
structure)
For some database storing a blob (or clob), store the version within the same
record as the data.
Original comment by joel.leitch@gmail.com
on 26 Apr 2011 at 11:26
I don't think we want to fix this in-framework. If you want to add a version
property to your top-level object, you should be able to accomplish what you
want.
Original comment by limpbizkit
on 30 Dec 2011 at 6:49
Original issue reported on code.google.com by
swall...@gmail.com
on 21 Jan 2011 at 4:54