change JSON function call to Object.toJSON

not all browsers have JSON.stringify, but Prototype puts in
Object.toJSON