{
    "url": "https://delaparra-services.nl/manuals/json-lezen-en-controleren",
    "locale": "en",
    "title": "Reading and validating JSON · DeLaParra Services",
    "description": "Reading JSON, recognising the most common mistakes and checking whether a file is valid.",
    "alternates": {
        "en": "https://delaparra-services.nl/manuals/json-lezen-en-controleren",
        "nl": "https://delaparra-services.nl/nl/handleidingen/json-lezen-en-controleren"
    },
    "formats": {
        "csv": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.csv",
        "md": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.md",
        "json": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.json",
        "zip": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.zip",
        "pdf": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.pdf"
    },
    "downloads": [
        {
            "url": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.csv",
            "encodingFormat": "text/csv",
            "name": "json-lezen-en-controleren.csv"
        },
        {
            "url": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.json",
            "encodingFormat": "application/json",
            "name": "json-lezen-en-controleren.json"
        },
        {
            "url": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.md",
            "encodingFormat": "text/markdown",
            "name": "json-lezen-en-controleren.md"
        },
        {
            "url": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.pdf",
            "encodingFormat": "application/pdf",
            "name": "json-lezen-en-controleren.pdf"
        },
        {
            "url": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.zip",
            "encodingFormat": "application/zip",
            "name": "json-lezen-en-controleren.zip"
        }
    ],
    "markdown": "Reading JSON, recognising the most common mistakes and checking whether a file is valid.\n\n## WHAT IT IS | Data in text form.\n\nJSON is a way of writing data as text so that programmes can read it. You’ll come across it in configuration files such as `package.json` and `composer.json`, and in API responses. You don’t need to write JSON, but it helps if you can read it.\n\n### 01 / An example\n\n```\n{\n  \"naam\": \"Mijn app\",\n  \"versie\": 2,\n  \"online\": true,\n  \"talen\": [\"nl\", \"en\"],\n  \"eigenaar\": {\n    \"naam\": \"Jan\",\n    \"stad\": \"Groningen\"\n  }\n}\n```\n\n### 02 / How to read it\n\n01. Between **{ }** is an object: a list of name-value pairs.\n02. The name is to the left of the colon, and the value is to the right.\n03. Text is enclosed in double quotation marks: \"My app\".\n04. Numbers, ‘true’, ‘false’ and ‘null’ are written without quotation marks.\n05. A list is enclosed within **[ ]**, such as [\"nl\", \"en\"].\n06. A value can itself be an object, such as ‘owner’.\n\n## THE RULES | Where things often go wrong.\n\nJSON is strict. Just one wrong character and the whole file stops working.\n\n### 03 / Common mistakes\n\n01. **Comma after the last item.** `\"stad\": \"Groningen\",}` is incorrect. There should be no comma after the last item.\n02. **Single quotation marks.** `'naam'` is incorrect. Always use double quotation marks: `\"naam\"`.\n03. **Missing comma.** There is always a comma between two items.\n04. **Comment.** JSON must not contain `//` or `/* */`. Some programmes accept them, but standard JSON does not.\n05. **Brackets that don’t match.** Every { has a }, every [ heeft een ].\n\n### 04 / What an error message means\n\nDo you see something like **Unexpected token** or **Expected ',' or '}'**, with a line number? If so, check that line and the one above it. The error is usually just before the point mentioned in the message.\n\n## CHECK | Is my JSON correct?\n\n### 05 / In VS Code\n\nOpen the file. Errors are highlighted with a red wavy line. Press **Shift + Alt + F** (Windows) or **Ctrl + Shift + I** (Linux) to have VS Code format the indentation neatly.\n\n### 06 / In the terminal\n\nWith Node.js installed:\n\n```\nnode -e \"JSON.parse(require('fs').readFileSync('package.json','utf8')); console.log('OK')\"\n```\n\nInstalled with Python:\n\n**Windows**\n```\npython -m json.tool package.json\n```\n\n**Linux**\n```\npython3 -m json.tool package.json\n```\n\nIf the file is correct, you’ll see ‘OK’ or the correct content. If there’s an error, you’ll see where it is.\n\n### 07 / Check online\n\nDo not paste JSON containing passwords, keys or customer data into a website to check it. Use VS Code or the terminal for this instead.\n\n## WORKING WITH AI | Ask your assistant.\n\n### 08 / A task for your AI assistant\n\n\"Check that the JSON files in this project are valid. If there is an error, indicate which line it is on and what you would change, and ask for permission before making any changes.\"\n\n**Good to know**\nMake a commit before you edit a JSON file manually. If anything goes wrong, you can use Git to revert to the previous version.\n\n",
    "structured_data": {
        "@context": "https://schema.org",
        "@graph": [
            {
                "@type": "TechArticle",
                "@id": "https://delaparra-services.nl/manuals/json-lezen-en-controleren#article",
                "url": "https://delaparra-services.nl/manuals/json-lezen-en-controleren",
                "headline": "Reading and validating JSON",
                "description": "Reading JSON, recognising the most common mistakes and checking whether a file is valid.",
                "inLanguage": "en",
                "subjectOf": {
                    "@id": "https://delaparra-services.nl/manuals/json-lezen-en-controleren#dataset"
                }
            },
            {
                "@type": "Dataset",
                "@id": "https://delaparra-services.nl/manuals/json-lezen-en-controleren#dataset",
                "name": "Reading and validating JSON",
                "description": "Reading JSON, recognising the most common mistakes and checking whether a file is valid.",
                "url": "https://delaparra-services.nl/manuals/json-lezen-en-controleren",
                "identifier": "https://delaparra-services.nl/manuals/json-lezen-en-controleren#dataset",
                "about": {
                    "@id": "https://delaparra-services.nl/manuals/json-lezen-en-controleren#article"
                },
                "publisher": {
                    "@type": "Organization",
                    "name": "DeLaParra Services",
                    "url": "https://delaparra-services.nl/"
                },
                "isAccessibleForFree": true,
                "inLanguage": "en",
                "isPartOf": {
                    "@type": "Dataset",
                    "@id": "https://delaparra-services.nl/manuals#dataset",
                    "name": "Manuals for working on your own app",
                    "url": "https://delaparra-services.nl/manuals"
                },
                "includedInDataCatalog": {
                    "@type": "DataCatalog",
                    "@id": "https://delaparra-services.nl/knowledge-hub#catalog",
                    "name": "Knowledge hub data catalog",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "distribution": [
                    {
                        "@type": "DataDownload",
                        "name": "json-lezen-en-controleren.csv",
                        "encodingFormat": "text/csv",
                        "contentUrl": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.csv",
                        "inLanguage": "en"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "json-lezen-en-controleren.json",
                        "encodingFormat": "application/json",
                        "contentUrl": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.json",
                        "inLanguage": "en"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "json-lezen-en-controleren.md",
                        "encodingFormat": "text/markdown",
                        "contentUrl": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.md",
                        "inLanguage": "en"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "json-lezen-en-controleren.pdf",
                        "encodingFormat": "application/pdf",
                        "contentUrl": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.pdf",
                        "inLanguage": "en"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "json-lezen-en-controleren.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/manuals/json-lezen-en-controleren.zip",
                        "inLanguage": "en"
                    }
                ]
            }
        ]
    }
}