LLMSdocs

PYTHON 3.13.0 / EDITORIAL NOTE / 2026-11-24 / v1

Read JSON and check the boundary

Parsing is not schema validation. Keep the input size bounded and check the resulting application values yourself.

AI-assisted editorial notes, not official Python documentation or customer submissions.

loads_input

json.loads decodes a JSON string; json.load reads from a file-like object.

JSON /facts/0/value
"string"

[1] Source lines 74-84

parse_float

The documentation shows parse_float=decimal.Decimal to decode 1.1 as Decimal rather than the default float.

JSON /facts/1/value
"decimal.Decimal"

[1] Source lines 97-99

input_size

The documentation recommends limiting the size of untrusted JSON input because decoding can consume considerable CPU and memory.

JSON /facts/2/value
"bounded"

[1] Source lines 21-24

round_trip_keys

Non-string dictionary keys are coerced to strings during encoding. A decode after encode may not reproduce the original dictionary.

JSON /facts/3/value
"strings"

[1] Source lines 227-234

Try the example

import json
from decimal import Decimal
value = json.loads('{"amount": 1.1}', parse_float=Decimal)
assert value["amount"] == Decimal("1.1")

This sample illustrates a decoder option. It does not impose an input-size limit or validate a business schema.

Source and reuse

Original
Python 3.13.0: json encoder and decoder
Version / observed
CPython v3.13.0 / 2026-11-24T04:53:54.630820+00:00
Use conditions
PSF License Version 2
Copyright (c) 2001-2024 Python Software Foundation; All Rights Reserved
Full license text
SHA256
6533f6d5be67f903194ba4b92335d079552edb69c4c8fd45d6215de60358dd8e

The hash identifies the archived source bytes retrieved from the version tag, not a publisher-issued signature. These are condensed notes with newly written examples, not a verbatim replacement for the manual.

Archived source text
Inspect the complete public JSON
{
  "schema": "llmsdocs-editorial-v1",
  "id": "decode",
  "language": "en",
  "revision": 1,
  "edition": "2026-11-24",
  "kind": "editorial",
  "title": "Read JSON and check the boundary",
  "intro": "Parsing is not schema validation. Keep the input size bounded and check the resulting application values yourself.",
  "html_url": "https://llmsdocs.com/en/manual/decode",
  "json_url": "https://llmsdocs.com/en/manual/decode.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": "The source was condensed into topic notes. Examples are newly written; Korean notes are translations.",
  "disclosure": "AI-assisted editorial notes, not official Python documentation or customer submissions.",
  "facts": [
    {
      "id": "decode-1",
      "key": "loads_input",
      "value": "string",
      "text": "json.loads decodes a JSON string; json.load reads from a file-like object.",
      "source_id": "python-json-313",
      "source_lines": "74-84"
    },
    {
      "id": "decode-2",
      "key": "parse_float",
      "value": "decimal.Decimal",
      "text": "The documentation shows parse_float=decimal.Decimal to decode 1.1 as Decimal rather than the default float.",
      "source_id": "python-json-313",
      "source_lines": "97-99"
    },
    {
      "id": "decode-3",
      "key": "input_size",
      "value": "bounded",
      "text": "The documentation recommends limiting the size of untrusted JSON input because decoding can consume considerable CPU and memory.",
      "source_id": "python-json-313",
      "source_lines": "21-24"
    },
    {
      "id": "decode-4",
      "key": "round_trip_keys",
      "value": "strings",
      "text": "Non-string dictionary keys are coerced to strings during encoding. A decode after encode may not reproduce the original dictionary.",
      "source_id": "python-json-313",
      "source_lines": "227-234"
    }
  ],
  "example": "import json\nfrom decimal import Decimal\nvalue = json.loads('{\"amount\": 1.1}', parse_float=Decimal)\nassert value[\"amount\"] == Decimal(\"1.1\")",
  "editorial_note": "This sample illustrates a decoder option. It does not impose an input-size limit or validate a business schema."
}

The source was condensed into topic notes. Examples are newly written; Korean notes are translations.