title: Get JSON facet_queries from Solr using JS
body: <p>I am using Solr facets to split queried documents based on their category and their published date. I managed to write a query that returns what I want in JSON format. The result is something like this:</p>
  
  <pre><code>  "facet_counts":{
      "facet_queries":{
        "publ_tmstmp:[NOW/DAY-7DAYS TO NOW/DAY+1DAY]":0, //this week
        "publ_tmstmp:[NOW/DAY-1MONTH TO NOW/DAY+1DAY]":0, //this month
        "publ_tmstmp:[NOW/DAY-1YEAR TO NOW/DAY+1DAY]":30}, //this year
      "facet_fields":{
        "doc_typ_sht_nm":[
          "GUIDE",30,
          "ANNOUNCEMENT",0,
          "HEADLINE",0,
          "IMAGE",0,
          "LATEST_UPDATES",0]},
      "facet_dates":{},
      "facet_ranges":{}}}
  </code></pre>
  
  <p>I have no problem looping through the categories but I can't figure out how to do the same for the publication dates using Javascript/jQuery. I have tried several ways like:</p>
  
  <pre><code>result.facet_counts["facet_fields"]
  result.facet_counts.facet_fields[0]
  result.facet_counts.facet_queries["publ_tmstmp:[NOW/DAY-7DAYS TO NOW/DAY+1DAY]"]
  var x in result.facet_counts.facet_queries
  </code></pre>
  
  <p>None of them work. Most of the time I get an "undefined". How can I iterate through my results?</p>
  
  <p>Thanks.</p>