Valid JSON (for real) is throwing error in JSON.Parse
<p>I am at a dead end.  I am baffled.  I am passing a stringified dictionary from Python (using json.dumps()) through UDP to an Ionic 2 (Typescript) application.  </p>

<p>The python code generating the messages:</p>

<pre><code>message = { 'time' :  str(round(float(op('indexFraction')[0]),3))  }
messageJSON = json.dumps(message)
#messageJSON = json.JSONEncoder().encode(message)
print(messageJSON)
op('udpout').send(messageJSON)  #sending out of TouchDesigner
</code></pre>

<p>My callback function on the Ionic side looks like this:</p>

<pre><code>socket.on('message', function (message, remoteAddress) {
    if (message.length &gt; 0) {
        console.log(message, typeof(message));
        // alert(message);
        // process response message

        var data = JSON.parse(message);
        console.log(data);
        if (data.time) {
            alert(data.time);
        }
    }
});
</code></pre>

<p>A sample message looks like this (typeof string):
{"time": "0.934"}</p>

<p>// this is a string, as evidenced by the Console.log</p>

<p>JSON.parse() throws the following:
index.html:1 Uncaught SyntaxError: Unexpected token  in JSON at position 17</p>

<p>I've tried all kinds of variants on the object.  It passes as valid on JSONlint.  It's so simple, no wacky characters.  Any ideas?</p>

<p>Thanks,
Marc</p>