在休息服务中序列化json的多个参数

时间:2017-10-28 15:02:17

标签: java json rest wildfly-10

我做了一个REST服务,我想发送一个带有JSON的参数:

console.time(`new ${number}`);
Readings.find({
  sensor: 'Freezer'
}).sort('-time').limit(number).exec((err, readings) => {
  if (err) {
    console.log(err);
    return;
  }
  readings.reverse();
  // readings.forEach(reading => {
  //   console.log(new Date(reading.time).toLocaleString());
  // });
  console.timeEnd(`new ${number}`);
  return;
});

console.time(`old ${number}`);
Readings.count({
 sensor: 'Freezer'
}, (err, count) => {
 if (err) {
   console.log(err)
   return;
 }
 Readings.find({
   sensor: 'Freezer'
 }).sort({'time':1}).skip(count - number).limit(number).exec((err, readings) => {
   if (err) {
     console.log(err);
     return;
   }
  //  readings.forEach(reading => {
  //    console.log(new Date(reading.time).toLocaleString());
  //  });
   console.timeEnd(`old ${number}`);
   return;
 });
});

这是我对REST服务的代码:

{
   "array":["hola","juan"]
   "name": "hol"
}

0 个答案:

没有答案