I have a HTTP CRUD API that I am able to successfully send commands to. I'm using cURL from the command prompt on Windows 11.
However, when I send the redirection character, "<<", as part of a JSON string, I get an error.
Example cURL command:
curl -X "PUT" -H "Content-Type: application/json" -d "{\"id\": \"b6481929-ec66\", \"dialogue\": \"<b> <<winks>>You are kewl </b>\"}" https://myfakeurl.xyz/items
The error:
<< was unexpected at this time.
Does anyone know how I can successfully escape the redirection characters (<<) in my JSON string within the cURL command?
I have tried using the Windows escape character ^ in the manner referenced in Escape angle brackets in a Windows command prompt
Update:
Using the ^ characters, here is modified JSON portion of the cURL command I entered:
"{\"id\": \"b6481929-ec66\", \"dialogue\": \"^<^ b> ^<^<winks^>^> You are kewl ^<^/b>\"}"
And the error I received:
The filename, directory name, or volume label syntax is incorrect.
I have also tried the following variations on the << portion of the JSON string:
^<^<^winks^>^>
^<^^<^winks^>^>
I'm running Windows 11 Pro. The build version is 10.0.22631.3737.
This is a trivial answer and I agree to deletion if appropriate (e.g. to close as typo)
c:\temp>curl -X "PUT" -H "Content-Type: application/json" -d "{\"id\": \"b6481929-ec66\", \"dialogue\": \"^<b^> ^<^<winks^>^>You are kewl ^</b^>\"}" https://httpbin.org/anything/anything
{
"args": {},
"data": "{\"id\": \"b6481929-ec66\", \"dialogue\": \"<b> <<winks>>You are kewl </b>\"}",
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Content-Length": "69",
"Content-Type": "application/json",
"Host": "httpbin.org",
"User-Agent": "curl/8.7.1",
"X-Amzn-Trace-Id": "Root=1-6684ef46-37d0b89965dd85fa60a3bed9"
},
"json": {
"dialogue": "<b> <<winks>>You are kewl </b>",
"id": "b6481929-ec66"
},
"method": "PUT",
"origin": "REDACTED",
"url": "https://httpbin.org/anything/anything"
}
c:\temp>