离线 · 无上传 · 浏览器本地完成Offline · no uploads · runs in the browser
CSV 转 JSON——只有能精确回写的字段才是数字CSV to JSON — numeric only when it round-trips exactly
把 CSV 交给 JSON 的常见实现是让解析器猜类型,而猜是有代价的:"00424" 变成 424、1e5 变成 100000、16 位卡号变成科学计数、1/2 变成一个日期。这条链路反过来做:先用严格读法把每个字段按原文读进来,再只在一个很严的条件下恢复数字类型——解析成数字、再写回、必须与原文一字不差,并且有效数字不超过 15 位。凡是回写不上的,一律留字符串。日期同理:CSV 里没有日期类型,2024-01-05 就是那串字符,转换不替你造一个。The usual way to turn CSV into JSON lets the parser guess types, and guessing has a price: "00424" becomes 424, 1e5 becomes 100000, a 16-digit card number becomes scientific notation and 1/2 becomes a date. This route does the opposite: every field is read verbatim first, and a numeric type is restored only under one strict condition — parse it, print it back, and the characters must be identical, within 15 significant digits. Anything that fails that round trip stays a string. Dates work the same way: CSV has no date type, so 2024-01-05 is those characters, and the conversion will not invent one for you.
这条链路怎么走How the route runs
CSVCSV JSONJSON
共 1 步,由扩展的路径搜索自动选出,中间产物不落盘。1 step, chosen by the extension's own path search; intermediate results never touch the disk.
会保留什么What carries over
- 首行做键、其余行成对象;空单元格不会写成 null,而是那个键直接缺失The first row becomes the keys and the rest become objects; an empty cell is not written as null — that key is simply absent
- 数字类型只在「解析→回写完全一致且有效数字不超过 15 位」时恢复,所以 00424、1e5、16 位卡号原样是字符串A numeric type returns only when parse-then-reprint is exact within 15 significant digits, so 00424, 1e5 and a 16-digit card number stay strings
- 看起来像日期的内容(2024-01-05、1/2)不会被猜成日期,仍是字符串——值保真优先于类型便利Text that looks like a date (2024-01-05, 1/2) is not guessed into one and remains a string — value fidelity before type convenience
- 输入按 UTF-8 → GB18030 → GBK 依次尝试解码,国内 Excel 另存的 GBK CSV 直接可读Input is decoded UTF-8 → GB18030 → GBK, so a GBK CSV saved by a Chinese Excel reads correctly straight away
- 结果在工作台的 JSON 三视图(树 / 数组表 / 原文)里预览;单文件批次还能在左右对照视图的结果侧编辑后再下载The result previews as a tree, an array table or raw text in the workbench; a single-file batch also opens the side-by-side view, where the result pane is editable before download
如实说明的限制What it does not do
- 一个 CSV 就是一张平面表,只读第一张表;没有「多 sheet」概念A CSV is one flat grid and only the first grid is read; there is no multi-sheet concept
- 这一侧不做 Excel 的公式转义:JSON 不会被 Excel 打开,转义符反而是脏数据。以 = 开头的字段原样进 JSON,别把结果直接喂给会执行公式的东西No Excel formula escaping happens on this side: JSON is not opened by Excel, so an apostrophe would be dirt. A field starting with = enters the JSON verbatim — do not feed the result to something that executes formulas
- 分隔符是读的时候自动判断的(逗号、分号、制表符、竖线都能直接转),所以判断偶尔不合你意——文件最前面加一行 sep=; 就能强制指定The delimiter is sniffed while reading (comma, semicolon, tab and pipe all convert as they stand), so the sniff can disagree with you — put sep=; on the first line to force it
- 读不到工作表时按该文件的解码错误处理,而不是静默给回空数组A file whose sheet cannot be read raises its own decode error instead of quietly returning an empty array
实操提示Working with it
- JSON 结果不写 BOM——BOM 是为 CSV 那侧的 Excel 准备的,这里不需要No BOM is written for JSON — that affordance belongs to the CSV side, where Excel reads it
- 一批最多 200 个文件、单个 100 MB 上限;结果文件名默认在源名后加日期与时间,模板可在偏好设置里改Up to 200 files per batch and 100 MB each; names default to the source name plus date and time, and the pattern is editable in preferences
常见问题Questions people actually ask
为什么 "007" 是字符串?Why is "007" a string?
这正是保护。一旦按数字存,回写就变成 7,前导零再也回不来。判定条件看的是「能不能一字不差地回写」,不是「像不像数字」。That is the protection working. Stored as a number it becomes 7 and the leading zero is unrecoverable. The test is “can it be written back character for character”, not “does it look numeric”.
我想要真的日期类型怎么办?What if I want real dates?
JSON 本身没有日期类型,最稳的做法就是保留字符串形状,在使用侧按需解析。想要别的格式,转完在编辑视图里批量替换即可——该视图只在单文件批次的左右对照里出现。JSON has no date type, so keeping the string shape and parsing where you use it is the stable answer. For another format, replace it in the editing view after conversion — that view shows up for a single-file batch in the side-by-side pane.
为什么空值不见了?Why did the empty values disappear?
这是行对象数组的默认形状:空单元格不给键。需要每行都带齐字段时,在预览编辑里补 null(编辑视图只在单文件批次出现),或改用 CSV / Excel 那条链路。That is the default shape of an array of row objects: an empty cell contributes no key. If every row must carry every field, add nulls in the editing view — single-file batches only — or take the CSV / Excel route instead.
不需要账号,也不需要联网:装好扩展后点图标,在新标签页里打开工作台,文件从磁盘直接选。No account and no network: install the extension, click its icon, and the workbench opens in a new tab reading straight off your disk.
从 Chrome 应用商店安装Install from the Chrome Web Store 安装步骤Install steps GitHub 源码Source on GitHub