title: Count grouped members of JSON array with jq 1.3 with inline output
body: <p>I have a JSON file:</p>
  
  <pre><code>[
    {
      "instance_AZs": [
          "us-east-1b",
          "us-east-1b",
          "us-east-1b",
          "us-east-1c",
          "us-east-1c",
          "us-east-1a",
          "us-east-1a",
          "us-east-1c",
          "us-east-1b",
          "us-east-1a",
          "us-east-1a",
          "us-east-1c",
          "us-east-1a",
          "us-east-1b",
          "us-east-1b",
          "us-east-1c",
          "us-east-1c",
          "us-east-1b"
      ],
      "ASGname": "myapp"
    }
  ]
  </code></pre>
  
  <p>Desired output is:</p>
  
  <pre><code>myapp.us-east-1a.5
  myapp.us-east-1b.7
  myapp.us-east-1c.6
  </code></pre>
  
  <p>As far as I can go with jq 1.3 syntax, I wrote this code:</p>
  
  <pre><code>cat file.json | jq -r '.[] | .ASGname, (.instance_AZs | group_by(.) | map(. | length , (. | unique ) [] ))'
  </code></pre>
  
  <p>Which produce an output:</p>
  
  <pre><code>myapp
  [
    5,
    "us-east-1a",
    7,
    "us-east-1b",
    6,
    "us-east-1c"
  ]
  </code></pre>
  
  <p>Can you please advice how to generate desired output?</p>