finished json implementation (i think)