任何人都可以建议如何从 POST 调用中获取 JSON 数据的 excel 输出吗?

Can anyone please suggest how to get the excel output for JSON data that I generated from url from POST call?

我有 JSON 数据,是通过 post 调用 url 获得的,我在控制台打印了 JSON 数据,但我需要读取 JSON 数据并获得 excel 输出。

Excel,我假设您指的是 CSV 格式。这是一种可在 Excel.

上查看的格式
  1. 手动执行:http://www.convertcsv.com/json-to-csv.htm

  2. 以编程方式进行:How can I convert JSON to CSV?

  3. 在java中,下面的代码是写入CSV。要编写 JSON 对象,您需要提取要编写的 JSON 对象的哪一部分,因为 JSON 有地图等对象不能简单地写入 table 格式.如果不清楚,请告诉我。

)

private static void generateCsvFile(String sFileName) {
try
  {
  FileWriter writer = new FileWriter(sFileName);

  // Start a row
  writer.append("Column1");
  writer.append(',');
  writer.append("Column2");
  writer.append('\n');
  // Start a new row
  writer.append("Row2Column1");
  writer.append(',');
  writer.append("Row2Column2");
  writer.append('\n');

  writer.flush();
  writer.close();
}
catch(IOException e)
{
  e.printStackTrace();
}

}

使用它:

generateCsvFile("/path/sample.csv");