0

I am newbie in Google Scripting. So i need help with parse JSON from ZOMATO API - there is a documentation: https://developers.zomato.com/documentation?lang=cs#!/restaurant/restaurant

I have this code:

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('data'); 



  // API KEY:
var api_key = "XXXX";  
  // Restaurant ID:
var res_id = "XXXX";
var url = 'https://developers.zomato.com/api/v2.1/dailymenu?res_id=' + res_id + '&apikey=' + api_key;



  var options = {
        "method": "GET",
        "contentType": "application/json",
    }; 

 var response = UrlFetchApp.fetch(url, options); // get api endpoint

   var json = response.getContentText(); // get the response content as text
   var data = JSON.parse(json); //parse text into json  
  Logger.log(data);

My problem is that i always get this error:

{daily_menus=[Ljava.lang.Object;@7357c5d7, status=success}

What is Ljava.lang.Object ? How can i solve this in Google Scripts? I need parse data from ZOMATO API - for example - i need daily menu for certain restaurant by ID.

libor
  • 43
  • 1
  • 1
  • 5

1 Answers1

0

Zomato APIs can only be accessed from server to server calls.

Instead of directly calling the API endpoint from the script, write a handler on your server end that would get data from Zomato API. Thus, call this handler(on your server) from the script to retrieve the required data.

Rohit Chandna
  • 251
  • 1
  • 6