首页 > 解决方案 > 如何将 Xlsx / Xls 文件转换为 JSON 文件(例如 sample.json)Node JS

问题描述

在此处输入图像描述

我正在尝试将此excel表/文件转换为json文件作为输出而不是原始数据(sample.json),我搜索了很多资源,但我没有找到任何工作代码或教程,所以我需要一些帮助,我已经链接了图像是excell数据,我怎样才能将它转换成如下的json文件并上传到MongoDB中。

示例.json

{
"Sheet1": [
    {
        "Qusetion Number": "1",
        "Question": "A program language",
        "A": "defines the form of the instruction",
        "B": "is always machine dependent",
        "C": "is never machine dependent",
        "D": "All of the above",
        "E ": "None of the above",
        "Answers": "defines the form of the instruction"
    },
    {
        "Qusetion Number": "2",
        "Question": "Quiestion 2",
        "A": "Option A",
        "B": "Option B",
        "C": "Option C",
        "D": "Option D",
        "E ": "Option E ",
        "Answers": "Option C"
    },
    {
        "Qusetion Number": "3",
        "Question": "Question 3",
        "A": "Option 5",
        "B": "Option 6",
        "C": "Option 9",
        "E ": "Option9",
        "Answers": "Option 6"
    },
    {
        "Qusetion Number": "4",
        "Question": "Question 4",
        "A": "456",
        "B": "221",
        "C": "889",
        "Answers": "456"
      }
    ]
  }

标签: node.jsreactjsmongodbnodejs-server

解决方案


推荐阅读