I'm trying to create a JSON object which looks something like this:
{
"scores": [{
"879212387": {
"elo": 125
}, {
"123768901": {
"elo": 173
}
}]
}
(where the numbers under json.scores are a variable named sid64)
but instead I just get something which looks like this
{
"scores": [{
"sid64": {
"elo": 125
}, {
"sid64": {
"elo": 173
}
}]
}
How can I dictate that I'm trying to make the object name a variable and not a string?
Current code:
obj.scores.push({
sid64:
{
elo
}
})