CheckMySchema

Structured data explained

Is a JSON file just a text file?

Yes. A .json file is plain text that encodes structured data for parsing by software. Here’s what that means, how programs treat it, and how to quickly verify a JSON file.

    Plain-text JSON open in a code editor

    Yes. A .json file is a plain-text file that encodes structured data. JSON is a lightweight, text-based data interchange format that software reads with a JSON parser, not by executing it RFC 8259.

    What “text file” means for JSON

    • Text-based and language-independent: JSON is a text format for serializing structured data RFC 8259.
    • Data types: objects and arrays, plus primitives string, number, boolean, and null RFC 8259.
    • Encoding on open networks: JSON text exchanged between systems that are not part of a closed ecosystem MUST be encoded as UTF-8 RFC 8259.
    • File/media identifiers: the registered media type is application/json and the common file extension is .json RFC 8259.
    • A JSON text can be any single serialized value (not only an object or array), for example true or 42 RFC 8259.
    JSON properties and values in a text editor

    How programs treat a .json file

    Programs read the file’s bytes and use a JSON parser to turn the text into native data structures (objects, arrays, numbers, strings, booleans, null). Parsers must accept all texts that conform to the JSON grammar; implementations may also impose practical limits (for example, on depth, size, or number precision) RFC 8259.

    JSON is data, not executable code. Using an eval-like mechanism to parse JSON is a security risk and is discouraged RFC 8259.

    An extension does not prove valid content

    Renaming notes.txt to notes.json changes the filename, not the data. The contents must still parse under the JSON grammar. Conversely, valid JSON saved in a .txt file can still be parsed when a program reads it explicitly. For private configuration or API data, validate locally rather than pasting secrets into a public online checker.

    When to save data as .json vs .txt

    • Use .json when the content is structured and will be parsed by software (APIs, configuration, data interchange).
    • Use .txt for freeform notes or prose where structure is not enforced.

    If a parser will consume the file, the .json extension clearly signals intent to people and tools.

    Worked examples

    Valid JSON

    {"name":"Alice","age":30,"tags":["developer","admin"],"active":true}
    

    Invalid JSON (intentional)

    {"name":"Alice","age":30,"tags":["developer","admin",]}
    

    Expected failure: the trailing comma after the last array element is not allowed by the JSON grammar; strict JSON parsing rejects it; a permissive extension mode may behave differently. For details, see our explainer on trailing commas in JSON and the formal grammar in RFC 8259.

    Plain text and JSON file icons

    Quick checklist: confirm a file is plain-text JSON

    FAQ

    Can a JSON file contain just a single value?

    Yes. A JSON text is any serialized value, such as an object, array, string, number, true, false, or null RFC 8259.

    What’s the correct media type and extension?

    The media type is application/json and the file extension is .json RFC 8259.

    CheckMySchema logo

    Related guides

    Official sources and further reading