Well, I might take a different approach at an answer, and try to get to a reasonable Lewis structure with data we already should have had from drawing structural diagrams! It's kinda upside down, since none of what's written below is happening in real-life chemistry.
The structure you have in mind is the diatomic oxygen molecule, with 12 electrons in its system overall.
$\hspace{33ex}$
$\hspace{45ex}$Source
While the peroxide ion overall has 14 electrons in its system, since each oxygen has 6 valence electrons and the system also has two extra electrons indicated by the $2-$ charge of the ion. Now, let's oversimplify this a bit: Imagine that in peroxide also, the oxygen atoms need to fulfill their octet configuration, hence each of them would have 8 electrons in its outer shell.
Let $N_b$ be the number of bonding electrons and $N_{nb}$ the number of non-bonding electrons of each oxygen atom. We know that
- A single oxygen atom would have non-bonding electrons and bonding electrons that fill the octet.
- All of the electrons in the system, which are the non-bonding electrons for each of the two oxygens, and the bonding electrons, make 14 electrons.
Hence we solve:
$$\Bigg\lbrace\begin{array}\\ N_b + N_{nb} = 8 \\ N_b + 2N_{nb} = 14 \end{array}\Bigg\rbrace \Rightarrow \boxed{N_b = 2},~\boxed{N_{nb} = 6} $$
Hence we could figure out how many bonding and non-bonding electrons there are in compounds we can draw Lewis structures for, by finding out the overall number of electrons (taking into account the number of electrons in the valence of each atom and the number of electrons lost or gained due to the charge of the ion) with a rudimentary approach.
Try to find out how many bonding and non-bonding electrons there are for the azide, permanganate, manganate, sulfate, oxalate, salicylate, and superoxide anions and thionyl, sulfuryl, nitrosyl and methanium cations.