JSONifying arrays and adding error EndState