JsonForge · JSON · 零上傳
JSON 自己指出錯誤在哪。
行、欄,以及那個字元。
都在這個分頁裡解析。
Unexpected token 在凌晨三點什麼都告訴不了你。貼上來,JsonForge 會標出解析失敗的行、欄與那個字元,接著格式化、打開可複製任何節點 JSONPath 的樹狀檢視、寫出範例隱含的 TypeScript 介面或 Zod schema,並攤平成 CSV。
Format, minify, validate
the error is the feature-
Walk the document
click any node · copies its pathKeys that are not plain identifiers are copied in bracket form, $["a-b"].items[0], so the path pastes straight into a JSONPath query. Very large arrays are listed 300 at a time instead of all at once.
Types from a sample
inference, not a contract-
-
An object that appears as {...} inside an array is merged across every element: a field missing from some elements becomes ? / .optional(), and a field that is a string in one and a number in another becomes a union. Empty arrays cannot say what they hold, so they come out as unknown · type them by hand.
Flatten to rows
dotted columns · round tripNested objects become dotted columns; an array stays in one cell as compact JSON, because it has no fixed number of columns. Empty cells are null and missing fields. CSV downloads carry a UTF-8 BOM so Excel opens Korean without mojibake.
-
解析實際做的事
三件常被混為一談的事01一次只報一個錯
JSON.parse 遇到第一個不能接受的 token 就停,所以修好被指出的字元,往往會露出下一個。這不是工具偷懶 · 文法上沒有辦法越過不合法的 token,每個解析器都這樣。修好、重貼、再來一次。
02重複的鍵是合法的
RFC 8259 只建議名稱應唯一,並未禁止,而每個引擎都默默保留最後一個。有兩個 "port" 的設定照樣解析成功,你會為一個在讀到之前就被覆蓋的値花上一小時。
03數字會失去精度
JSON 數字會變成 IEEE-754 倍精度,因此 9007199254740993 這樣的 id 回來時已經變了,19 位數的帳戶編號也會悄悄出錯。長識別碼請在兩端都以字串處理。
常見問題
錯誤 · 隱私 · 型別語法正確,App 卻一直拒絕,為什麼?
null、日期格式不同、數字用字串送出。把你實際收到的回應放進 TypeScript · Zod 分頁,和程式期待的樣子比對 · 差別通常是一個可選欄位或一個型別。