Updated to accept json object or json files