What is a 'trailing comma' error in JSON and how to fix it?

Question

Grade: Education Subject: Support
What is a 'trailing comma' error in JSON and how to fix it?
Asked by:
59 Viewed 59 Answers

Answer (59)

Best Answer
(259)
A 'trailing comma' error occurs when there is an extra comma after the last element in a JSON object or array. For example, `{"key": "value",}` is invalid. To fix it, simply remove the trailing comma. Many JSON validators will point out these specific errors.