Hi there.
I’m relatively new to JavaScript and web development. Three weeks ago I read a “Beginner to Professional” book on JavaScript so I could build a web server which can connect to my software application that I created, send data to a database and display it and render a web page displaying some of the data to the end user.
I have got it all working in the way I want it except for one last bit. My software successfully sends JSON data to my web server which it receives. My software converts an array and sends something like this for example:
{“matchnumber”:1, “tablenumber”:1, “roundname”:“qualifier”}
My Node.JS server which I’m currently running on Visual Studio Code on localhost is receiving the message fine. I output it to the console using “req.body” and it returns it like this:
[Object: null prototype] { ‘{“matchnumber”:1, “tablenumber”:1, “roundname”:“qualifier”}’: ‘’}
Obviously I want the first set of curly brackets to be square brackets so it becomes an array so I can extract the data from the object. If I use JSON.parse() on the above I get an error message saying it cannot parse it.
Can anyone help me as to what I’m doing wrong here. It’s literally the last step I need to have my server fully functioning.
Thanks, Aaron