mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[PR #4416] [MERGED] fix: trailing comma makes json invalid #4787
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#4787
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/4416
Author: @anwarulislam
Created: 10/8/2024
Status: ✅ Merged
Merged: 10/28/2024
Merged by: @AndrewBastin
Base:
next← Head:hotfix/jsonc-invalid-issue📝 Commits (7)
2b431affix: trailing comma issue makes json invalidf837704chore: remove trailing commas on prettify887a126fix: jsonc prettifier0183d52fix: strip comments and trailing comma by walking the AST4daa7d9fix: prevent exceptions when incoming node doesn't have adequate infoeeb676cfix: ensure invalid JSON request body contents are sent along641d6fbrefactor: keep the node conversion functions pure📊 Changes
5 files changed (+93 additions, -266 deletions)
View changed files
📝
packages/hoppscotch-common/src/components/environments/my/Details.vue(+2 -2)📝
packages/hoppscotch-common/src/components/environments/teams/Details.vue(+2 -2)📝
packages/hoppscotch-common/src/helpers/editor/linting/jsonc.ts(+79 -4)📝
packages/hoppscotch-common/src/helpers/editor/linting/jsoncPretty.ts(+7 -255)📝
packages/hoppscotch-common/src/helpers/utils/EffectiveURL.ts(+3 -3)📄 Description
Closes #4411
What's changed
This pull request fixes an issue where a trailing comma in a JSON object was causing the JSON to be invalid when we send it to the server. This was leading to errors when the JSON was being parsed.
The fix involves removing the trailing comma before sending it to the server, ensuring the JSON is correctly formatted and valid before proceeding request.
You may still have comments and trailing commas in your json body. That won't invalidate json because comments and trailing commas being stripped out before sending the request.
Notes to reviewers
Examples JSON body
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.