JSON sang Go Struct
Tự động tạo Go struct từ JSON. Hỗ trợ nested objects, arrays, json tags, và PascalCase naming convention.
#json#go#golang#struct#types#code generation#developer
Loading tool...
How to use
- 1Dán JSON object vào ô nhập
- 2Đặt tên cho root struct (mặc định: Root)
- 3Chọn có thêm json tags không và có dùng pointer cho nested không
- 4Nhấn "Xử lý" để nhận Go struct sẵn dùng
Frequently Asked Questions — JSON sang Go Struct
Hỗ trợ nested objects không?+
Có. Mỗi nested object sẽ được tạo thành một named struct riêng biệt, tự động được đặt tên theo key.
JSON tags được tạo như thế nào?+
Tool tự động thêm `json:"fieldName"` cho mỗi field, dùng camelCase làm JSON tag name.
Nếu JSON có null value thì sao?+
Null được xử lý thành `interface{}` hoặc `*interface{}` khi bật pointer mode.