这是我非常基本的 GET 函数

app.get('/', function(request, response) {
  response.contentType('application/json');
  var lid = request.param("lid");
  client.llen(lid, function(reply, len){
      client.lrange(lid, 0, len-1, function(reply, messages){
      console.log(messages);
      response.send(messages);
    })
  });
});

出于某种原因,控制台输出和我得到的响应看起来像
[ <Buffer 5b 7b 22 6c 61 77 79 65 72 5f ... 61 64 61 74 61 22 3a 22 36 22 7d 5d> ]

我将这些存储为 JSON 字符串:
client.lpush(lid, JSON.stringify(to_store))

任何想法为什么我的响应不是 JSON 字符串?

谢谢你。

最佳答案

尝试

console.log(messages.toString());

10-08 09:16