title: How to convert redis hashes to JSON?
body: <p>I'm using node_redis to supply a node service with a JSON representation of objects I get from redis. I think it's probably relatively basic stuff for a lot of you, but I'm stumped. I get to the point where I send my response <em>before</em> I've been through all my hashes and stored them. Here's the coffeescript:</p>
  
  <pre><code>    objects = []
      client.keys 'objects*', (err,keys) -&gt;
        for key in keys
          client.hgetall key, (err,obj) -&gt;
            objects.push obj
      response.end JSON.stringify objects
  </code></pre>
  
  <p>and generated JavaScript:</p>
  
  <pre><code>      objects= [];
        client.keys('objects*', function(err, keys) {
          var key, _i, _len, _results;
          _results = [];
          for (_i = 0, _len = keys.length; _i &lt; _len; _i++) {
            key = keys[_i];
            _results.push(client.hgetall(key, function(err, obj) {
              return objects.push(obj);
            }));
          }
          return _results;
        });
        return response.end(JSON.stringify(objects));
  </code></pre>
  
  <p>I don't know how to put my code on vacation while it waits for the inner stuff to complete. I suspect there is some way to handle it, but I can't think of anything. Thanks to all.</p>