What's the best way to return a Java Map using the JSON format? My specific need is a key -> value association between a date and a number.
My concern is this: My structure basically contains N elements of the same type (a mapping between a date and a number), and I want to be able to quickly iterate through them in Javascript.
In XML, I would have:
<relation date='mydate' number='mynumber'/>
<relation date='mydate' number='mynumber'/>
...
<relation date='mydate' number='mynumber'/>
and I would use jQuery like this:
$(xml).find("relation").each(function() {
$(this).attr("date"); // the date
$(this).attr("number"); // the number
})
It's my first experience with JSON and I would like to know if I can do something similar.