export function toJson(game, userid) { let copy = structuredClone(game) // make a copy if (game.state == "playing") { if (copy.player1 == userid && copy.next == 1 || copy.player2 == userid && copy.next == 2) { copy["myturn"] = true } } else if (game.state == "won") { if (copy.player1 == userid && copy.next == 1 || copy.player2 == userid && copy.next == 2) { copy["winner"] = true } } return copy }