mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 09:16:03 +03:00
[PR #5634] fix: detect trailing comma and report error at correct position #5293
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5293
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5634
Author: @tlawjddnjs
Created: 11/30/2025
Status: 🔄 Open
Base:
main← Head:fix/5502-detect-json-trailing-comma📝 Commits (2)
afb66fdfix: detect trailing comma and report error at correct positionecd614eUpdate packages/hoppscotch-common/src/helpers/jsoncParse.ts📊 Changes
1 file changed (+30 additions, -23 deletions)
View changed files
📝
packages/hoppscotch-common/src/helpers/jsoncParse.ts(+30 -23)📄 Description
Closes #5502
This PR fixes an issue where trailing commas in JSON objects or arrays were not detected as invalid JSON in the request body editor. The server rejected such bodies, but the editor did not highlight the error. This change updates the parser to properly detect and report trailing commas with accurate error positions.
What's changed
parseObjandparseArr.expect(",").}or], report aSyntaxErrorpointing to the comma token rather than the closing bracket/brace.Notes to reviewers
Summary by cubic
Detects trailing commas in JSON objects/arrays and highlights the comma as the error in the request body editor. Aligns UI validation with server behavior for clearer feedback.
Written for commit
ecd614e875. Summary will update automatically on new commits.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.