JSON parse error in node.js even after decoding URL

data={"convID":"E40E92FD4B410","serverDate":"2012/06/15 07:51:07 PM","masterInfo":{"instance":"808477149_R_BDD72269D1C1E98A32D8C83EC58CF471","appVersion":"0.97.13.D","depth":4,"jsonURL":"//testtn","scenario":"R","serverDate":"2012/06/15 07:51:07 PM ","deviceName":"M’s","localDate":"2012/5/6 11:14:59 AM PDT"}}

JSON.parse(data);

gives an error. This was generated by JSON.generate in a ruby script and sent to node http server, decodeURIComponent was applied to get the data printed above. still JSON parse fails with this error:

undefined:1
ate":"2012/06/15
^
SyntaxError: Unexpected token d
at Object.parse (native)

In your code example data is JS object. But JSON.parse takes a string as its parameter, not an object. So your code must be:

data='{"convID":"E40E92FD4B410","serverDate":"2012/06/15 07:51:07 PM","masterInfo":{"instance":"808477149_R_BDD72269D1C1E98A32D8C83EC58CF471","appVersion":"0.97.13.D","depth":4,"jsonURL":"//testtn","scenario":"R","serverDate":"2012/06/15 07:51:07 PM ","deviceName":"M’s","localDate":"2012/5/6 11:14:59 AM PDT"}}';

JSON.parse(data);

So, check the value and the type of data variable in your real code.