[GH-ISSUE #5465] [bug]: cURL Import Fails When JSON Body Contains Escaped Newlines #2097

Open
opened 2026-03-16 23:11:20 +03:00 by kerem · 2 comments
Owner

Originally created by @yousufmunna143 on GitHub (Oct 8, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5465

Is there an existing issue for this?

  • I have searched existing issues and this bug hasn't been reported yet

Platform

Desktop App

Browser

Chrome

Operating System

macOS

Bug Description

Summary:
Importing cURL commands with raw or multiline JSON bodies containing escaped newline characters (\n) results in an empty request body in Hoppscotch. The same cURL works correctly in Postman.


Steps to Reproduce

  1. Copy the following cURL command with a multiline JSON body:

    curl 'http://app.exampleapp.test/v1/v2/contacts' \
      -H 'Accept-Language: en-IN,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,te;q=0.6' \
      -H 'Authorization: Bearer pv_XXXXXX' \
      -H 'Cache-Control: no-cache' \
      -H 'Connection: keep-alive' \
      -H 'Content-Type: application/json' \
      -H 'Origin: http://sam.exampleapp.test' \
      -H 'Pragma: no-cache' \
      -H 'Referer: http://sam.exampleapp.test/' \
      -H 'User-Agent: Mozilla/5.0 ...' \
      -H 'accept: application/json' \
      --data-raw $'{\n  "first_name": "John",\n  "last_name": "Doe",\n  "email": "john.doe@example.com",\n  "phone": "+1234567890",\n  "company_id": 100000009,\n  "custom_fields": {\n    "100000009": "SMB"\n  }\n}' \
      --insecure
    
  2. Paste this into the Hoppscotch cURL import tool.

  3. Observe that the request body section is empty.


Expected Behavior

The imported request should populate the body field with the JSON data.

Actual Behavior

Hoppscotch leaves the request body empty.
Postman correctly populates the JSON body when using the same cURL.


Additional Notes

  • The issue occurs only when the cURL uses $'...' string syntax with escaped newline characters (\n) inside the JSON.
  • Removing the escape characters and using a plain multiline JSON body allows Hoppscotch to import correctly.
  • Manually entering the JSON as raw body also works fine.
  • Similar issues have been reported, but none clearly address escaped newlines in $'...' formatted cURLs.

Attachment

https://github.com/user-attachments/assets/295ec4c0-0a85-4fdc-a7ed-f29eeb76f92a


I'm willing to contribute a fix if the team doesn't have bandwidth to address this.


Deployment Type

Hoppscotch Cloud

Version

No response

Originally created by @yousufmunna143 on GitHub (Oct 8, 2025). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5465 ### Is there an existing issue for this? - [x] I have searched existing issues and this bug hasn't been reported yet ### Platform Desktop App ### Browser Chrome ### Operating System macOS ### Bug Description **Summary:** Importing cURL commands with raw or multiline JSON bodies containing escaped newline characters (`\n`) results in an empty request body in Hoppscotch. The same cURL works correctly in Postman. --- ### Steps to Reproduce 1. Copy the following cURL command with a multiline JSON body: ```bash curl 'http://app.exampleapp.test/v1/v2/contacts' \ -H 'Accept-Language: en-IN,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,te;q=0.6' \ -H 'Authorization: Bearer pv_XXXXXX' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Content-Type: application/json' \ -H 'Origin: http://sam.exampleapp.test' \ -H 'Pragma: no-cache' \ -H 'Referer: http://sam.exampleapp.test/' \ -H 'User-Agent: Mozilla/5.0 ...' \ -H 'accept: application/json' \ --data-raw $'{\n "first_name": "John",\n "last_name": "Doe",\n "email": "john.doe@example.com",\n "phone": "+1234567890",\n "company_id": 100000009,\n "custom_fields": {\n "100000009": "SMB"\n }\n}' \ --insecure ``` 2. Paste this into the **Hoppscotch cURL import tool**. 3. Observe that the **request body** section is empty. --- ### Expected Behavior The imported request should populate the **body** field with the JSON data. ### Actual Behavior Hoppscotch leaves the request body empty. Postman correctly populates the JSON body when using the same cURL. --- ### Additional Notes * The issue occurs only when the cURL uses `$'...'` string syntax with escaped newline characters (`\n`) inside the JSON. * Removing the escape characters and using a plain multiline JSON body allows Hoppscotch to import correctly. * Manually entering the JSON as raw body also works fine. * Similar issues have been reported, but none clearly address escaped newlines in `$'...'` formatted cURLs. --- ### Attachment https://github.com/user-attachments/assets/295ec4c0-0a85-4fdc-a7ed-f29eeb76f92a --- **I'm willing to contribute a fix if the team doesn't have bandwidth to address this.** --- ### Deployment Type Hoppscotch Cloud ### Version _No response_
Author
Owner

@nigeldelviero commented on GitHub (Oct 8, 2025):

Can I work on this issue?

<!-- gh-comment-id:3382467728 --> @nigeldelviero commented on GitHub (Oct 8, 2025): Can I work on this issue?
Author
Owner

@yousufmunna143 commented on GitHub (Oct 22, 2025):

@nivedin @abraham @Sockalingam29 @silentmatt I actively use this feature at work, and this is a blocker for me. I’ve had to open Postman just for this. It’s been more than two weeks since I opened this issue. I’m really interested in working on it, could you please assign it to me?

<!-- gh-comment-id:3430749793 --> @yousufmunna143 commented on GitHub (Oct 22, 2025): @nivedin @abraham @Sockalingam29 @silentmatt I actively use this feature at work, and this is a blocker for me. I’ve had to open Postman just for this. It’s been more than two weeks since I opened this issue. I’m really interested in working on it, could you please assign it to me?
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#2097
No description provided.