如何快速轻松地将电子表格数据转换为JSON? [英] How can I quickly and easily convert spreadsheet data to JSON?

查看:309
本文介绍了如何快速轻松地将电子表格数据转换为JSON?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将电子表格数据(例如从Excel/*.xls文件或Open Office等)转换为JSON文件.最简单的方法是什么?

I want to convert spreadsheet data (such as from Excel/*.xls files or Open Office, etc.) to JSON files. What is the easiest way to accomplish this?

推荐答案

假定您的意思是最简单的",并且不一定在寻找以编程方式进行此操作的方法,则可以执行以下操作:

Assuming you really mean "easiest" and are not necessarily looking for a way to do this programmatically, you can do this:

0)如果尚未添加,则在电子表格中添加一行列音乐家".也就是说,如果您在以下列中有数据:

0) Add, if not already there, a row of "column Musicians" to the spreadsheet. That is, if you have data in columns such as:

Rory Gallagher  Guitar
Gerry McAvoy    Bass
Rod de'Ath  Drums
Lou Martin  Keyboards
Donkey Kong Sioux   Self-Appointed Semi-official Stomper

...您可能想在第0行中添加音乐家"和乐器"(您可能必须在其中插入一行)

...you might want to add "Musician" and "Instrument" in row 0 (you might have to insert a row there)

1)将文件另存为CSV文件.

1) Save the file as a CSV file.

2)将CSV文件的内容复制到剪贴板

2) Copy the contents of the CSV file to the clipboard

3)转到 http://www.convertcsv.com/csv-to- json.htm

4)确认已选中第一行是列名"复选框

4) Verify that the "First row is column names" checkbox is checked

5)将CSV数据粘贴到内容区域

5) Paste the CSV data into the content area

6)混搭将CSV转换为JSON"按钮

6) Mash the "Convert CSV to JSON" button

使用上面显示的数据,您现在将拥有:

With the data shown above, you will now have:

[
  {
    "MUSICIAN":"Rory Gallagher",
    "INSTRUMENT":"Guitar"
  },
  {
    "MUSICIAN":"Gerry McAvoy",
    "INSTRUMENT":"Bass"
  },
  {
    "MUSICIAN":"Rod D'Ath",
    "INSTRUMENT":"Drums"
  },
  {
    "MUSICIAN":"Lou Martin",
    "INSTRUMENT":"Keyboards"
  }
  {
    "MUSICIAN":"Donkey Kong Sioux",
    "INSTRUMENT":"Self-Appointed Semi-Official Stomper"
  }
]

使用这种简单/极简的数据可能不是必需的,但是如果使用大量数据,则可以通过检查这些数据是否存在异常和异常来避免长期困扰您的时间和头痛.

With this simple/minimalistic data, it's probably not required, but with large sets of data, it can save you time and headache in the proverbial long run by checking this data for aberrations and abnormalcy.

7)转到此处: http://jsonlint.com/

8)将JSON粘贴到内容区域

8) Paste the JSON into the content area

9)混搭验证"按钮.

9) Mash the "Validate" button.

如果JSON良好,您将在下面的结果"部分中看到有效JSON"注释;如果没有,它将告诉您问题出在哪里,以便您进行修复.

If the JSON is good, you will see a "Valid JSON" remark in the Results section below; if not, it will tell you where the problem[s] lie so that you can fix it/them.

这篇关于如何快速轻松地将电子表格数据转换为JSON?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆