-2

I'm sending some JSON to a Node server via CURL:

curl.exe "-i -X POST -H "Content-Type: application/json" -d '{"command":"print \"foo\"","language":"python","procID":"8540"}' http://127.0.0.1:1337/myServer.js?execute=yes  

I receive the data just fine, and can print it with console.log(...) which would indicate that it's a string. When I run a JSON.parse(...) on it, I get an error:

undefined:1
'{command:print "foo",language:python,port:8080}'
^
SyntaxError: Unexpected token '

Any ideas why this happens?

I should note that the JSON sent in the command line:

{"command":"print \"foo\"","language":"python","procID":"8540"}

passes JSONlint.

easythrees
  • 1,530
  • 3
  • 16
  • 43

1 Answers1

-1

This is a JSON object, not a string that's being received.

easythrees
  • 1,530
  • 3
  • 16
  • 43