SmartJson.io
← All JSON error messages

Trailing comma in JSON: "Expected double-quoted property name"

By Santhi · Messages captured October 9, 2026 on 11 runtimes · How we test

JSON does not allow a comma after the last item in an object or array. JavaScript, Python and JSON5 do, which is why the mistake is so common. Most parsers never mention the comma: after a comma they expect another property name, find a }, and complain about that.

What each runtime prints

We ran this input through JSON.parse in each browser and Node version, and through json.loads in Python. These are the messages exactly as printed.

Input: A comma before }
{"name": "Ada", "age": 36,}
RuntimeExact message
Chrome 151Node 24Node 22Expected double-quoted property name in JSON at position 26 (line 1 column 27)
Firefox 153JSON.parse: expected double-quoted property name at line 1 column 27 of the JSON data
Safari 26 (WebKit)BunJSON Parse error: Property name must be a string literal
Node 20Expected double-quoted property name in JSON at position 26
Node 18Unexpected token } in JSON at position 26
Python 3.13JSONDecodeError: Illegal trailing comma before end of object: line 1 column 26 (char 25)
Python 3.12Python 3.10JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 27 (char 26)
  • Python 3.13 added a message that names the problem: "Illegal trailing comma before end of object". Python 3.12 and older say "Expecting property name enclosed in double quotes", which sounds like a quoting problem.
  • Python 3.13 points at the comma itself (column 26). Every other parser points at the } after it (column 27).
  • Safari says "Property name must be a string literal" and gives no position at all.
  • In an array the messages change. Node 24 says "Unexpected token ']', "[1, 2,]" is not valid JSON" for [1, 2,], and Python 3.13 says "Illegal trailing comma before end of array".

Edit it or paste your own. It runs in your browser; nothing is uploaded.

Open the full JSON Repair tool →

Common causes

  1. 1

    A hand-edited file

    Deleting the last item of a list, or copying a line from the middle to the end, leaves its comma behind.

  2. 2

    JavaScript or Python habits

    Both languages allow trailing commas, and code formatters often add them. JSON copied from a code file keeps them.

  3. 3

    JSON built by string concatenation

    A loop that appends `"item",` for every item leaves a comma after the last one.

  4. 4

    A config file read by a strict parser

    Some tools read their config as JSONC, which allows trailing commas and comments. The same file fails when another tool reads it with a plain JSON parser.

How to fix it

Delete the comma before the } or ]. If a program writes the JSON, let the serializer build it so the commas are always right.

JavaScript

// Instead of building the string by hand:
const body = JSON.stringify({ name: 'Ada', tags: ['math', 'engines'] });

Python

import json

body = json.dumps({"name": "Ada", "tags": ["math", "engines"]})
  • For a large file, the column in the Chrome, Node or Firefox message lands on the } right after the comma.
  • If the file is meant to be JSONC (with comments and trailing commas), read it with a JSONC parser, such as the jsonc-parser package in Node, instead of JSON.parse.

Related

  • Single quotes in JSON: "Expected property name or '}'"
  • Extra data: two JSON documents where one was expected
  • JSON Repair
  • JSON Validator

How we tested: the messages above come from running each input through the real parsers (Chrome 151, Firefox 153, Safari 26 (WebKit), Node 24, Node 22, Node 20, Node 18, Bun, Python 3.13, Python 3.12, Python 3.10) on October 9, 2026. The script and inputs are listed on How we test.

Published October 9, 2026. Found a message that reads differently in your version? Tell us and we will add it.

All Tools & Converters

JSON Tools

  • JSON Hub
  • JSON Formatter
  • JSON Validator
  • JSON Repair
  • JSON Error Messages
  • JSON Viewer
  • JSON Minify
  • JSON Stringify
  • JSON Sorter
  • JSON Compare
  • JSON to CSV
  • JSON to XML
  • JSON to YAML

XML Tools

  • XML Hub
  • XML Formatter
  • XML Validator
  • XML Compare
  • SOAP Formatter
  • WSDL Formatter
  • XML to JSON
  • XML to CSV

CSV Tools

  • CSV Hub
  • CSV Formatter
  • CSV Validator
  • CSV to JSON
  • CSV to XML
  • Compare Tools

    • JSON Compare
    • XML Compare
    • YAML Compare
    • CSV Compare
    • Text Compare

YAML Tools

  • YAML Hub
  • YAML Formatter
  • YAML Validator
  • YAML to JSON
  • Other Tools

    • Converters Hub
SmartJson.io

JSON, XML, CSV and YAML tools that run in your browser. Nothing you paste is uploaded.

Sitemap

Company

  • About Us
  • Contact
  • How We Test
  • Changelog
  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • Disclaimer

© 2026 SmartJson.io. All rights reserved.

Report a problem with this page
Made withfor developers