홈페이지: https://github.com/rocketship88/typed-json-tcl
typed_json은 타입 정보를 완벽하게 보존하는 순수 Tcl 기반의 JSON 파서입니다. tDOM의 `-json` 옵션과 유사하게 동작하지만, 바이너리 확장 모듈이 필요하지 않습니다.
두 가지 버전의 코드가 존재합니다.
- 첫 번째 버전은 dict 구조를 사용하여 속도가 더 빠를 수 있지만, 중복 키를 처리할 수 없습니다.
- 두 번째 버전은 오직 리스트 연산만 사용하여 중복 키를 지원하고, tDOM과의 호환성이 더 높습니다.
# Skip built-in tests when sourcing
set no_tests 1
source jsonparser.tcl
# Parse JSON with type information preserved
set data [typed_json::json2dict {{"name": "Alice", "age": 30}}]
puts $data
# Output: OBJECT {name {STRING Alice} age {NUMBER 30}}
# Extract values
puts [typed_json::getValue [typed_json::getPath $data "name"]]
# Output: Alice
'Tcl & Tk > 확장 패키지 (Extension Package)' 카테고리의 다른 글
Blend2d 1.6 (0) | 2025.09.22 |
---|---|
thtmlview (0) | 2025.09.18 |
pix 0.6 (0) | 2025.09.08 |
XOTcl 1.6.8 (0) | 2025.09.05 |
TclOO 1.0.4 (0) | 2025.09.05 |