Modified function that returns data from JSON file