String.split method won’t work after JSON parse method

I wrote this code:

if (localStorage.getItem("names") !== undefined) {
var names = [JSON.parse(localStorage.getItem("names"))];
namesO = names.split(",");
alert(namesO[1])
names = namesO;
var userNames = [JSON.parse(localStorage.getItem("userNames"))];
userNamesO = userNames.split(",");
userNames = userNamesO;
var passwords = [JSON.parse(localStorage.getItem("passwords"))];
passwordsO = passwords.split(",");
passwords = passwordsO;
} else {
    alert(localStorage.getItem("names"));
    var names = [];
    var userNames = [];
    var passwords = [];
}

However, this string.split on line 3 doesn’t seem to work and breaks the rest of my code, causing the entire program(not shown) to work.

It seems that it is the value of names that is erroring, but I can’t find out how to fix it.