Help

The Community will be undergoing maintenance from Friday February 21 - Friday, February 29 and will be "read only" during this time. To learn more, check out our Announcements blog post.

How to get info out of the JSON that an API delivered

Topic Labels: ImportingExporting
7897 10
cancel
Showing results for 
Search instead for 
Did you mean: 
Ron_Daniel
8 - Airtable Astronomer
8 - Airtable Astronomer

I’m a total newbie to JavaScript, and pretty proud of myself that I’ve figured out how to connect to my company’s API to get store information.

console.log(await storeInfo.json());
is displaying all of the JSON returned from the API call, but now how do I get that data out of the JSON?

Example:

CONSOLE.LOG

  1. :arrow_forward: (1) [Object]
  2. :arrow_forward: 0: Object
    1. StoreNumber: “1234”
    2. StoreName: “Joe’s Market”
    3. :arrow_forward: StorePhoneNumbers: Array(2)
    1. :arrow_forward: 0: Object
    2. Description: “Fax”
    3. PhoneNumber: “800-555-1212”
    4. :arrow_forward: 1: Object
    5. Description: “Landline”
    6. PhoneNumber: “800-555-2121”

How can I pull the store name and phone numbers out into individual variables that I can do stuff with?

10 Replies 10

Congrats! :tada:

Looks like the top level of the data is an array, versus an object. It was hard to tell in your initial post. Glad you figured it out.