@Override
  public Object fromBody(TypedInput body, Type type) throws ConversionException {

    try (BufferedReader reader = new BufferedReader(new InputStreamReader(body.in()))) {
      String json = reader.readLine();
      log.debug("Converting response from influxDb: {}", json);

      Map result = getResultObject(json);
      List<Map> seriesList = (List<Map>) result.get("series");

      if (CollectionUtils.isEmpty(seriesList)) {
        log.warn("Received no data from Influxdb.");
        return null;
      }

      Map series = seriesList.get(0);
      List<String> seriesColumns = (List<String>) series.get("columns");
      List<List> seriesValues = (List<List>) series.get("values");
      List<InfluxDbResult> influxDbResultsList = new ArrayList<InfluxDbResult>(seriesValues.size());

      // TODO(joerajeev): if returning tags (other than the field names) we will need to skip tags
      // from this loop,
      // and to extract and set the tag values to the influxDb result.
      for (int i = 1;
          i < seriesColumns.size();
          i++) { // Starting from index 1 to skip 'time' column

        String id = seriesColumns.get(i);
        long firstTimeMillis = extractTimeInMillis(seriesValues, 0);
        long stepMillis = calculateStep(seriesValues, firstTimeMillis);
        List<Double> values = new ArrayList<>(seriesValues.size());
        for (List<Object> valueRow : seriesValues) {
          if (valueRow.get(i) != null) {
            String val = valueRow.get(i).toString();
            values.add(Double.valueOf(val));
          }
        }
        influxDbResultsList.add(new InfluxDbResult(id, firstTimeMillis, stepMillis, null, values));
      }

      log.debug("Converted response: {} ", influxDbResultsList);
      return influxDbResultsList;
    } catch (IOException e) {
      e.printStackTrace();
    }

    return null;
  }
@Test
  public void deserializeWithFloatValues() throws Exception {
    List<InfluxDbResult> results = setupWithFloats();
    TypedInput input = new TypedByteArray(MIME_TYPE, EXAMPLE_WITH_FLOATS.getBytes());
    List<InfluxDbResult> result =
        (List<InfluxDbResult>) influxDbResponseConverter.fromBody(input, List.class);
    assertThat(result).isEqualTo(results);
  }