I have to make dynamic hashes, so the class example won't work since the class variables are static. I am s开发者_运维百科ending in a hashmap object to toJson but it isn't working. Any suggestions on what to do?
If you can't work out the Gson problem, you might look at Crockford's JSON classes for Java, they deal with this exact use case. Not an answer for the Gson issue, though; just an end-run.
精彩评论