Fixed bug in json codeby completely replacing the code.