1

So I just want to make a curl (curl.exe not the basic curl on Powershell) and I'm getting this error on Powershell (Windows 10):

{"statusCode":400,"error":"Bad Request","message":"Unexpected token u in JSON at position 2"}

This is my command:

curl.exe -X POST -H "Content-Type: application/json" -d '{ "username": "Code", "password": "Witcher" }' http://localhost:3000/login

This works on a git bash console as it is. How do you convert this to be used in a Powershell console?

Daniel Tkach
  • 576
  • 2
  • 9
  • 18
  • 1
    The sad reality as of PowerShell 7.2.x is that an _extra, manual_ layer of `\ `-escaping of embedded `"` characters is required in arguments passed to _external programs_. This _may_ get fixed in a future version, which _may_ require opt-in. See [this answer](https://stackoverflow.com/a/66837948/45375) to the linked duplicate for details. – mklement0 Feb 24 '22 at 17:42

0 Answers0