curl on Windows, error passing -d option

I am running curl on Windows,

and can not quite pass a JSON string to the web service successfully

FIrst a successful attempt, notice I do not have any spaces between the bracket and the first string within JSON,
in other words:  -d '{"creditcardnumber"

C:\curl>curl -H "Content-Type: application/json" -i -d '{"creditcardnumber":"555
5222233334444"}' http://localhost:8081
HTTP/1.1 200 OK
Date: Thu, 10 Jul 2014 10:54:40 -0700
Content-Type: application/json
Content-Length: 37

'{creditcardnumber:5555222233334444}'

Open in new window


Right now I am not worried about the response from the web service, but in the above example, the passing of the JSON worked well.

Now for an unsuccessful example, where I pass spaces just after the bracket on the "-d" option:

C:\curl>curl -H "Content-Type: application/json" -i -d '{ "creditcardnumber":"55
55222233334444" }' http://localhost:8081
curl: (3) Port number out of range
curl: (3) [globbing] unmatched close brace/bracket in column 1
HTTP/1.1 200 OK
Date: Thu, 10 Jul 2014 12:51:51 -0700
Content-Type: application/json
Content-Length: 2

'{

Open in new window


Let me repeat the curl error in the above statement

curl: (3) [globbing] unmatched close brace/bracket in column 1

Open in new window


So how can I handle sending the -d JSON test without getting this issue?
Anthony LuciaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shalom CarmelCTOCommented:
Common problem in windows.
Place the JSON in a file and do
curl -d @filename -H "Content-Type: application/json" -i  http://localhost:8081
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Services

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.