modify function to use json data