title: How to extract an element from an array (in an array?) within a Json into Google Sheets
body: <p>Trying to set up a Pokemon spread sheet and don't want to enter lots of data points.</p>
  
  <p>Would like help either solving problem, or if I could be directed where to look to teach myself that would also be really helpful.</p>
  
  <p>Trying to get individual data points out of what i think is called an array in within a JSON (clearly little experience), and input them into Google Sheets.</p>
  
  <p>In my example the aim is to get the base_stat of speed extracted</p>
  
  <p>Below is the end of the JSON(of some 10k lines);  <a href="https://pokeapi.co/api/v2/pokemon/1/" rel="nofollow noreferrer">https://pokeapi.co/api/v2/pokemon/1/</a></p>
  
  <p>The data point we want to extract is on line 3, but I wasn't sure how much else was valuable.</p>
  
  <pre><code>    "stats": [
  {
    "base_stat": 45,
    "effort": 0,
    "stat": {
      "name": "speed",
      "url": "https://pokeapi.co/api/v2/stat/6/"
    }
  },
  {
    "base_stat": 65,
    "effort": 0,
    "stat": {
      "name": "special-defense",
      "url": "https://pokeapi.co/api/v2/stat/5/"
    }
  },
  {
    "base_stat": 65,
    "effort": 1,
    "stat": {
      "name": "special-attack",
      "url": "https://pokeapi.co/api/v2/stat/4/"
    }
  },
  {
    "base_stat": 49,
    "effort": 0,
    "stat": {
      "name": "defense",
      "url": "https://pokeapi.co/api/v2/stat/3/"
    }
  },
  {
    "base_stat": 49,
    "effort": 0,
    "stat": {
      "name": "attack",
      "url": "https://pokeapi.co/api/v2/stat/2/"
    }
  },
  {
    "base_stat": 45,
    "effort": 0,
    "stat": {
      "name": "hp",
      "url": "https://pokeapi.co/api/v2/stat/1/"
    }
  }
    ],
    "types": [
      {
        "slot": 2,
        "type": {
          "name": "poison",
          "url": "https://pokeapi.co/api/v2/type/4/"
        }
      },
      {
        "slot": 1,
        "type": {
          "name": "grass",
          "url": "https://pokeapi.co/api/v2/type/12/"
        }
      }
    ],
    "weight": 69
  }
  </code></pre>
  
  <p>so when the JSON doesn't have the square brackets I have had success retrieving data with code like</p>
  
  <pre><code>function GETSPEED(Name) {
    var myUrl = "https://pokeapi.co/api/v2/pokemon/" + Name;
    var jsonData = UrlFetchApp.fetch(myUrl);
    var jsonString = jsonData.getContentText();
    var jsonObject = JSON.parse(jsonString);
    var Value = (jsonObject.speed)
    return Value;
  }
  </code></pre>
  
  <p>Have deduced that I have two problems;</p>
  
  <p>1) "Value = (jsonObject.speed)" the .speed isn't separated by a colon from my wanted answer and therefore my eventual ask is the wrong thing.</p>
  
  <p>2) What I'm requesting on the line before still holds many elements (arrays?)</p>
  
  <p>For part 1 'base_stat' is repeated alot and I dont know how to differentiate.
  For part 2 I dont know where to start.</p>
  
  <p>I've had a good google around for an answer to this, or a place to start learning and didnt find any point on which to build.</p>
  
  <p>Anyway thank you in advance for any help rendered or time spent reading this.</p>