title: How to grab value from array
body: <p>I am pulling an array from my DB that is saved in this format:</p>
  
  <pre><code>[categories] =&gt; [
      {"category":"Exit Sign"},
      {"category":"Leaving"},
      {"category":"Illuminated"},
      {"category":"Sign"},
      {"category":"Red"},
      {"category":"Warning Sign"},
      {"category":"Above"}
  ]
  </code></pre>
  
  <p>How can I loop through each {} and get the category?</p>
  
  <p>Edit: I have attempted passing each JSON array from my DB through json_decode() but I am getting the following error "json_decode() expects parameter 1 to be string, array given..." Any idea what would cause this?</p>
  
  <p>Edit 2: Here is the var_dump output for just one row in my DB: </p>
  
  <pre><code>array(1) {
    ["categories"]=&gt;
    string(845) "[{"category":"Built Structure"},{"category":"The Americas"},{"category":"Sky"},{"category":"New York City"},{"category":"Manhattan - New York City"},{"category":"USA"},{"category":"History"},{"category":"Suspension Bridge"},{"category":"Brooklyn - New York"},{"category":"Brooklyn Bridge"},{"category":"Scenics"},{"category":"Skyscraper"},{"category":"River"},{"category":"Downtown District"},{"category":"East River"},{"category":"Cityscape"},{"category":"Bridge - Man Made Structure"},{"category":"City"},{"category":"Lighting Equipment"},{"category":"Arch"},{"category":"Urban Skyline"},{"category":"Architecture"},{"category":"Sunset"},{"category":"Night"},{"category":"Modern"},{"category":"Urban Scene"},{"category":"Tower"},{"category":"Famous Place"},{"category":"Gate"},{"category":"Outdoors"},{"category":"East"},{"category":"Travel"}]"
  }
  </code></pre>
  
  <p>Got it! I had to pass $array['categories'] into json_decode and then it worked properly. Thanks everyone for your help!</p>