Added JSON generation code