[GH-ISSUE #4857] [bug]: invalid json body #1826

Closed
opened 2026-03-16 21:55:42 +03:00 by kerem · 13 comments
Owner

Originally created by @frankliexodus on GitHub (Mar 7, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4857

Originally assigned to: @CuriousCorrelation on GitHub.

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Image

When I use the UI I get back the error that the JSON is invalid.

However when I take the curl command code and run it in my terminal there isn't such an issue. It leads me to believe that there is a formatting issue when the request body is sent.

Steps to reproduce

Add request body to post. Click submit

Environment

Production

Version

Cloud

Originally created by @frankliexodus on GitHub (Mar 7, 2025). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4857 Originally assigned to: @CuriousCorrelation on GitHub. ### Is there an existing issue for this? - [x] I have searched the existing issues ### Current behavior <img width="1226" alt="Image" src="https://github.com/user-attachments/assets/e265baa9-d074-436a-919f-7e29b7d12686" /> When I use the UI I get back the error that the JSON is invalid. However when I take the curl command code and run it in my terminal there isn't such an issue. It leads me to believe that there is a formatting issue when the request body is sent. ### Steps to reproduce Add request body to post. Click submit ### Environment Production ### Version Cloud
kerem 2026-03-16 21:55:42 +03:00
Author
Owner

@frankliexodus commented on GitHub (Mar 7, 2025):

From the backend printing out the string here is what I'm seeing

Raw request body content type: <class 'str'>
Raw request body length: 15
Raw request body (first 1000 chars): [object Object]

Looks like we aren't serializing the body properly

<!-- gh-comment-id:2706779766 --> @frankliexodus commented on GitHub (Mar 7, 2025): From the backend printing out the string here is what I'm seeing ``` Raw request body content type: <class 'str'> Raw request body length: 15 Raw request body (first 1000 chars): [object Object] ``` Looks like we aren't serializing the body properly
Author
Owner

@frankliexodus commented on GitHub (Mar 7, 2025):

The problem does not occur in the desktop version

<!-- gh-comment-id:2706803777 --> @frankliexodus commented on GitHub (Mar 7, 2025): The problem does not occur in the desktop version
Author
Owner

@CuriousCorrelation commented on GitHub (Mar 7, 2025):

Hi, thanks for the report. And thanks for confirming that this doesn't occur on the desktop app.

Could you share which interceptor your are using, and if this occurs on any other website, say perhaps sending similar request to https://echo.hoppscotch.io and seeing [object Object] in the response body?

<!-- gh-comment-id:2706969013 --> @CuriousCorrelation commented on GitHub (Mar 7, 2025): Hi, thanks for the report. And thanks for confirming that this doesn't occur on the desktop app. Could you share which interceptor your are using, and if this occurs on any other website, say perhaps sending similar request to https://echo.hoppscotch.io and seeing `[object Object]` in the response body?
Author
Owner

@boarush commented on GitHub (Mar 7, 2025):

I am using the Chrome extension as the interceptor and I am only seeing this when sending a POST request, so definitely a problem in serializing the JSON body.

For GET requests, I am not getting any issues in the response body.

<!-- gh-comment-id:2707004321 --> @boarush commented on GitHub (Mar 7, 2025): I am using the Chrome extension as the interceptor and I am only seeing this when sending a POST request, so definitely a problem in serializing the JSON body. For GET requests, I am not getting any issues in the response body.
Author
Owner

@brunnobb commented on GitHub (Mar 7, 2025):

Check
https://github.com/hoppscotch/hoppscotch/issues/4837#issuecomment-2704991884

<!-- gh-comment-id:2707041583 --> @brunnobb commented on GitHub (Mar 7, 2025): Check https://github.com/hoppscotch/hoppscotch/issues/4837#issuecomment-2704991884
Author
Owner

@formbook commented on GitHub (Mar 7, 2025):

this problem is occurring in the browser also, with firefox, endpoint is tested as working

Failed to parse the request body as JSON: [0]: expected value at line 1 column 2

<!-- gh-comment-id:2707104317 --> @formbook commented on GitHub (Mar 7, 2025): this problem is occurring in the browser also, with firefox, endpoint is tested as working Failed to parse the request body as JSON: [0]: expected value at line 1 column 2
Author
Owner

@robmv commented on GitHub (Mar 7, 2025):

It is failing for me on Firefox with the extension interceptor v0.37. The packet capture shows it is sending the toString() of a JS object.

Image

<!-- gh-comment-id:2707239438 --> @robmv commented on GitHub (Mar 7, 2025): It is failing for me on Firefox with the extension interceptor v0.37. The packet capture shows it is sending the toString() of a JS object. ![Image](https://github.com/user-attachments/assets/297f48b7-4b19-4a42-8d8c-0d3c54e398ff)
Author
Owner

@bernardassan commented on GitHub (Mar 7, 2025):

I was facing this issue yesterday and found that it was an issue with hoppscotch after doing a repro that was working for both curl and postman but not hoppscotch. I was about creating a new issue, good to see this.

This is only affecting POST request as was previously stated. Sending any json data leads to the same result.

I am using firefox browser with the extension.

Image

<!-- gh-comment-id:2707421022 --> @bernardassan commented on GitHub (Mar 7, 2025): I was facing this issue yesterday and found that it was an issue with `hoppscotch` after doing a repro that was working for both `curl` and `postman` but not `hoppscotch`. I was about creating a new issue, good to see this. This is only affecting `POST` request as was previously stated. Sending any `json` data leads to the same result. I am using `firefox` browser with the `extension`. ![Image](https://github.com/user-attachments/assets/5dddfd95-1414-48d1-bca5-14c914e73c82)
Author
Owner

@brunnobb commented on GitHub (Mar 7, 2025):

A quick debug on the plugin has shown where the issue is..
seems to be missing a JSON.stringfy..

Image

Because axiosConfig.data here is a json object..
but fetch needs it stringfied. As it is not using axios (naming implies that it were axios before, and axios automatically stringfies content.

<!-- gh-comment-id:2707685527 --> @brunnobb commented on GitHub (Mar 7, 2025): A quick debug on the plugin has shown where the issue is.. seems to be missing a JSON.stringfy.. ![Image](https://github.com/user-attachments/assets/09272f3d-e7e8-475f-b191-cbf353a9beae) Because axiosConfig.data here is a json object.. but fetch needs it stringfied. As it is not using axios (naming implies that it were axios before, and axios automatically stringfies content.
Author
Owner

@SaiRev0 commented on GitHub (Mar 8, 2025):

Its happening in desktop application as well.

<!-- gh-comment-id:2708380488 --> @SaiRev0 commented on GitHub (Mar 8, 2025): Its happening in desktop application as well.
Author
Owner

@yassentials commented on GitHub (Mar 10, 2025):

I got this response from my backend app (I am using MS Edge with extension)

{
  "status": "error",
  "message": {
    "statusCode": 400,
    "message": "\"[object Object]\" is not valid JSON"
  }
}

Here is my request

Content-Type: application/json

{ "name": "user@user.com", "password": "123123"}
<!-- gh-comment-id:2709257326 --> @yassentials commented on GitHub (Mar 10, 2025): I got this response from my backend app (I am using MS Edge with extension) ```json { "status": "error", "message": { "statusCode": 400, "message": "\"[object Object]\" is not valid JSON" } } ``` Here is my request `Content-Type: application/json` ```json { "name": "user@user.com", "password": "123123"} ```
Author
Owner

@jamesgeorge007 commented on GitHub (Mar 11, 2025):

Hi, we have a PR with the fix scheduled for the next patch release.

<!-- gh-comment-id:2713647277 --> @jamesgeorge007 commented on GitHub (Mar 11, 2025): Hi, we have a [PR](https://github.com/hoppscotch/hoppscotch/pull/4860) with the fix scheduled for the next patch release.
Author
Owner

@jamesgeorge007 commented on GitHub (Mar 13, 2025):

Closing this issue since it's resolved in the latest release. Please let us know if you have any feedback.

<!-- gh-comment-id:2720066599 --> @jamesgeorge007 commented on GitHub (Mar 13, 2025): Closing this issue since it's resolved in the latest release. Please let us know if you have any feedback.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#1826
No description provided.