indent
양의 정수 indent는 단계마다 해당 수만큼 공백을 넣습니다. 문서는 indent=4를 사용한 출력을 보여줍니다.
JSON /facts/0/value
4compact_separators
separators=(',', ':')를 지정하면 구분자 공백을 없애 압축 출력할 수 있습니다.
JSON /facts/1/value
[",",":"]cli
셸에서 json.tool 명령은 JSON을 검증하고 보기 좋게 출력합니다. 따옴표 없는 속성 이름은 오류를 일으킵니다.
JSON /facts/2/value
"python -m json.tool"framed
JSON은 프레임 단위 프로토콜이 아닙니다. 같은 파일에 dump를 반복 호출하면 유효하지 않은 JSON 파일이 됩니다.
JSON /facts/3/value
false실행 예제
import json
record = {"name": "sample", "enabled": True}
print(json.dumps(record, indent=4))
print(json.dumps(record, separators=(",", ":")))서식은 서명이 아니며 별도로 직렬화한 두 문서의 바이트가 같음을 보장하지 않습니다. 필요한 값을 비교하거나 별도의 바이트 수준 규약을 정의하세요.
출처와 이용 조건
- 원문
- Python 3.13.0: json encoder and decoder
- 판본 / 관측 시각
- CPython v3.13.0 / 2026-11-24T04:53:54.630820+00:00
- 사용 조건
- PSF License Version 2
Copyright (c) 2001-2024 Python Software Foundation; All Rights Reserved
라이선스 전문 - SHA256
- 6533f6d5be67f903194ba4b92335d079552edb69c4c8fd45d6215de60358dd8e
해시는 버전 태그에서 수집한 원문 바이트를 식별하며 발행자의 서명이 아닙니다. 자체 예제를 포함한 요약 자료이며 원문 전체를 대체하지 않습니다.
보관 원문 보기공개 JSON 전체 보기
{
"schema": "llmsdocs-editorial-v1",
"id": "format",
"language": "ko",
"revision": 1,
"edition": "2026-11-24",
"kind": "editorial",
"title": "검토하기 좋은 문서 형식",
"intro": "읽기 좋은 출력은 문서 검토에 도움이 됩니다. 압축 출력은 공백을 줄일 뿐 데이터의 목적을 바꾸지 않습니다.",
"html_url": "https://llmsdocs.com/ko/manual/format",
"json_url": "https://llmsdocs.com/ko/manual/format.json",
"source": {
"id": "python-json-313",
"title": "Python 3.13.0: json encoder and decoder",
"url": "https://github.com/python/cpython/blob/v3.13.0/Doc/library/json.rst",
"version": "CPython v3.13.0",
"observed_at": "2026-11-24T04:53:54.630820+00:00",
"sha256": "6533f6d5be67f903194ba4b92335d079552edb69c4c8fd45d6215de60358dd8e",
"license": "PSF License Version 2",
"license_url": "https://github.com/python/cpython/blob/v3.13.0/LICENSE",
"copyright": "Copyright (c) 2001-2024 Python Software Foundation; All Rights Reserved",
"snapshot": "/manual-source/json.rst",
"license_snapshot": "/manual-source/LICENSE.txt"
},
"changes": "원문을 주제별로 요약하고 한국어로 번역했습니다. 예제는 자체 작성했습니다.",
"disclosure": "AI 보조로 구성한 자체 편집 자료입니다. Python 공식 문서나 고객 제출 문서가 아닙니다.",
"facts": [
{
"id": "format-1",
"key": "indent",
"value": 4,
"text": "양의 정수 indent는 단계마다 해당 수만큼 공백을 넣습니다. 문서는 indent=4를 사용한 출력을 보여줍니다.",
"source_id": "python-json-313",
"source_lines": "54-61, 179-184"
},
{
"id": "format-2",
"key": "compact_separators",
"value": [
",",
":"
],
"text": "separators=(',', ':')를 지정하면 구분자 공백을 없애 압축 출력할 수 있습니다.",
"source_id": "python-json-313",
"source_lines": "189-192"
},
{
"id": "format-3",
"key": "cli",
"value": "python -m json.tool",
"text": "셸에서 json.tool 명령은 JSON을 검증하고 보기 좋게 출력합니다. 따옴표 없는 속성 이름은 오류를 일으킵니다.",
"source_id": "python-json-313",
"source_lines": "119-128"
},
{
"id": "format-4",
"key": "framed",
"value": false,
"text": "JSON은 프레임 단위 프로토콜이 아닙니다. 같은 파일에 dump를 반복 호출하면 유효하지 않은 JSON 파일이 됩니다.",
"source_id": "python-json-313",
"source_lines": "212-216"
}
],
"example": "import json\nrecord = {\"name\": \"sample\", \"enabled\": True}\nprint(json.dumps(record, indent=4))\nprint(json.dumps(record, separators=(\",\", \":\")))",
"editorial_note": "서식은 서명이 아니며 별도로 직렬화한 두 문서의 바이트가 같음을 보장하지 않습니다. 필요한 값을 비교하거나 별도의 바이트 수준 규약을 정의하세요."
}원문을 주제별로 요약하고 한국어로 번역했습니다. 예제는 자체 작성했습니다.