mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[GH-ISSUE #4411] [bug]: JSON Prettify adds trailing commas, causing invalid JSON #1615
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#1615
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?
Originally created by @ninemind on GitHub (Oct 7, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4411
Originally assigned to: @anwarulislam on GitHub.
Is there an existing issue for this?
Current behavior
When using the "Prettify" feature on JSON in the in the request body, trailing commas are added after the last property in an object, resulting in an invalid JSON format that does not conform to the JSON standard.
Steps to reproduce
Raw Request BodyContent-Typetoapplication/jsonNotice that the resulting JSON is not valid according to the JSON standard.
Environment
Production
Version
Self-hosted
@ninemind commented on GitHub (Oct 7, 2024):
The editor does not provide any indication that the resulting JSON is invalid after adding trailing commas. This lack of validation can lead to confusion, as the JSON appears correct but causes issues when sent in a request. Specifically, many APIs reject the request body or fail to process it correctly due to the invalid trailing commas, leading to unexpected errors.
@yashs33244 commented on GitHub (Oct 7, 2024):
can i solve this issue ..?
@adelrodriguez commented on GitHub (Oct 7, 2024):
Can confirm, just ran into this issue as well after updating to the latest version.
@Pranay-Pandey commented on GitHub (Oct 8, 2024):
Can this be solved by changing the DEFAULT_OPTIONS for formatting in the file
packages/hoppscotch-common/src/helpers/editor/linting/jsoncPretty.tsWhy do we have trailingComma as true, instead of false?
@NayamAmarshe commented on GitHub (Oct 25, 2024):
Please fix this!
@subframe7536 commented on GitHub (Oct 25, 2024):
Please set the default
trailingCommatofalse🙏@sscotth commented on GitHub (Oct 26, 2024):
Prettier has a native JSON parser that handles JSON correctly. It can even convert a POJO into a proper JSON object which could improve the current feature by simply using it natively.
JSONC with trailing commas challenges
@jamesgeorge007 commented on GitHub (Nov 1, 2024):
#4416 released in v2024.10.0.