Open GoogleCodeExporter opened 9 years ago
Updated
What is the expected output? What do you see instead?
Expected output - runtime exception
Actual output - correct JSON string
OS - Windows XP
Original comment by ray.may...@gmail.com
on 22 Jul 2011 at 3:53
You're reporting that GSON works too well? Why don't I fix the docs that claim
we don't support generics. Please point me at these docs.
Original comment by limpbizkit
on 23 Jul 2011 at 4:49
Here is the link
https://sites.google.com/site/gson/gson-user-guide#TOC-Serializing-and-Deseriali
zing-Gener
And the following works for me (contrary to what the doc says)
List<String> myStrings = new List<String>();
gson.toJson(myStrings); // Will cause a runtime exception
Original comment by ray.may...@gmail.com
on 23 Jul 2011 at 4:55
The behaviour of lib is as per documentation. I feel u are confused between
serialization and deseralization.
I quto from docs ....."You can serialize the collection with Gson without doing
anything specific: toJson(collection) would write out the desired output.
However, deserialization with fromJson(json, Collection.class) will not work
since Gson has no way of knowing how to map the input to the types. " ..
What u are doing is serialization . Docs talk of deserialization
Original comment by maks....@gmail.com
on 22 Nov 2011 at 4:51
I too felt bit worried when i am using gson.toJson(obj); for both
non-generic and generic object.The document saying "May not serialize
foo.value correctly" in generic type serialization section buts its working
fine for most of the examples i have tried. So can some one please let me
know " Do serializing both generic and non-generic type using
gson.toJson(obj) cause any trouble in any situation".
Original comment by gvh...@gmail.com
on 17 Dec 2013 at 9:09
Original issue reported on code.google.com by
ray.may...@gmail.com
on 22 Jul 2011 at 3:50