On Thu, Jan 26, 2012 at 11:52 AM, Jordi Planadecursach <planad...@gmail.com> wrote: > So then it is a problem of: org.JSON library which I use for > serialization: > > new JSONObject(myBeanWithLongs).toString() > > That converts Long -> non string number.
Yes and no. JSON (RFC 4627) doesn't make any restriction on the value range for numbers, so the org.json library is right in not serializing longs into strings. But JSON also says "An implementation may set limits on the range of numbers." Given that numbers in JavaScript are IEEE 754 binary64 values (equivalent of a Java double), and JsonUtils (used by AutoBeans) uses native JSON.parse() or a fallback on eval(), then numbers in the parsed JSON have to fit in a JS Number / Java double. Because all Java longs do not fit in a Java double, AutoBean encodes longs as strings, and therefore expects them to be strings (or in the proposed patch, follows Postel's law by always serializing as strings, but accepting numbers and strings for deserialization. > The problem of unserializing collections with AutoBean codex persists. > The workaround is to use a List. Then it works well. AutoBeans only supports Lists and Sets as collection types: http://code.google.com/p/google-web-toolkit/wiki/AutoBean#Property_types -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.