[json-lib-user] How can I prevent json-lib from converting Map keys to Strings?
Brought to you by:
aalmiray
From: Jim T. <we...@ya...> - 2010-08-14 03:17:09
|
I have a few Maps which use Integer types as keys. When converting to json string, typically the keys turn into String values (i.e., they are enclosed in double quotes). The same happens when I'm converting a json string to a Map. Even though the keys in the string are not enclosed by double quotes, json-lib creates Map instances that have keys of type String. I know that the JSON spec defines only { string : value } for objects, however this is too restrictive in my use case. I basically can't send those beans to the client side because they come back with incorrect types, resulting is ClassCastExceptions everywhere. Is there a way to make the json-lib respect the Integer key type of my Maps, and leave them as such? Thanks |