1

I'm trying to run the EasyRTC default server code and examples.

If you look at the Node console you can see the JSON string returned in "body". Then immediately after, I get an error that "d" is not defined. The JSON is valid so how can this be?

Thanks for taking a look. I really need your advice.

enter image description here

Locohost
  • 1,682
  • 5
  • 25
  • 38

2 Answers2

2

So as per usual, about 5 minutes after posting here, the answer comes to me...

body = JSON.parse(body)
Locohost
  • 1,682
  • 5
  • 25
  • 38
0
console.log("typeof body=", typeof body);

Returns "object" or "string" ? It must be a string so you must JSON.parse it first.

Ilya Kharlamov
  • 3,698
  • 1
  • 31
  • 33