title: jquery .map() return object inside map
body: <p>Heyho,</p>
  
  <p>I am just building somekind of geocoder and i need to beam a json-map to the groovy backend,</p>
  
  <p>trying to map this ul structure <strong>:</strong> <a href="http://jsfiddle.net/PJFVN/1/" rel="nofollow">http://jsfiddle.net/PJFVN/1/</a></p>
  
  <pre><code>&lt;ul id="hiddenmap"&gt;
  &lt;li  class="hidden" id="street"&gt;Westerwarft 2&lt;/li&gt;
  &lt;li  class="hidden" id="plz"&gt;25859&lt;/li&gt;
  &lt;li  class="hidden" id="city"&gt;Hallig Hooge&lt;/li&gt;
  &lt;li  class="hidden" id="country" value="" &gt;DE&lt;/li&gt;
  &lt;li  class="hidden" id="lon" &gt; 8.516472&lt;/li&gt;
  &lt;li  class="hidden" id="lat" &gt;54.577993&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>to a map looking like </p>
  
  <pre><code>[{"street":"Westerwarft 2","plz":"25859","location":{"lat":"54.577993","lon":" 8.516472"},"country":"DE"}]
  </code></pre>
  
  <p>using following js :</p>
  
  <pre><code>var map =  $('#hiddenmap').map(function() {
  var $item = $(this);
  var loc =   '{"lat":"'+$item.find('li#lat').text()+'","lon":"'+$item.find('li#lon').text()+'"},';
  return {  
  street: $item.find('li#street').text(),
  plz: $item.find('li#plz').text(),
  location:loc ,
  country: $item.find('li#country').text()
  };
  }).get();
  var v = JSON.stringify(map); 
  alert(v);
  </code></pre>
  
  <p>but as you can see in see in the fiddle, my dirty attempt throws out </p>
  
  <pre><code>[{"street":"Westerwarft 2","plz":"25859","location":"{\"lat\":\"54.577993\",\"lon\":\" 8.516472\"},","country":"DE"}]
  </code></pre>
  
  <p>so i need a native way to get the location object inside the map,
  and perspectivly i will need to join more adresses to the map</p>
  
  <p>is there a way to do so ? </p>
  
  <p>because currently i am hardcore repeating myself, building up the maps manually for every different case looking terrible like :</p>
  
  <pre><code>       var String = '['+'{'+'"fax":'+'"'+fax1+'"'+','+'"genau":'+genau1+','+'"land":'+'"'+land1+'"'+','+'"location": {'+'"lon":'+lon1+','+'"lat":'+lat1+'},'+'"notruf":'+'"'+notruf1+'"'+','+'"ort":'+'"'+ort1+'"'+','+'"plz":'+'"'+plz1+'"'+','+'"strasse":'+'"'+strasse1+'"'+','+'"telefon":'+'"'+telefon1+'"},{'+'"fax":'+'"'+fax2+'"'+','+'"genau":'+genau2+','+'"land":'+'"'+land2+'"'+','+'"location": {'+'"lon":'+lon2+','+'"lat":'+lat2+'},'+'"notruf":'+'"'+notruf2+'"'+','+'"ort":'+'"'+ort2+'"'+','+'"plz":'+'"'+plz2+'"'+','+'"strasse":'+'"'+strasse2+'"'+','+'"telefon":'+'"'+telefon2+'"}]';
  </code></pre>
  
  <p>i need to get rid of this</p>
  
  <p>thanks in advance for any hint</p>