Sending a String concatenated with variable raises an error in Minecraft

Okay, so, I’m having trouble sending players strings combined with variables. For example, this line of code:

client.write("chat", { message: ("Username:"+data.data[0]["name"].toString())})

This data variable is a JSON object. Printing out

"Username:"+data.data[0]["name"].toString()

Works without an error, but when I try send it to the client, the client disconnects with this error message:

Internal Exception: io.netty.handler.codec.DecoderException: 
com.google.gson.JsonSyntaxException: 
com.google.gson.stream.MalformedJsonException: Use 
JsonReader.setLenient(true) to accept malformed JSON at line 1 column 10

BTW, I’m using npm minecraft-protocol javascript