title: python combine values for a specific key separated by comma
body: <p>Is there a way to combine multiple values for a specific key separated by comma. In my case i am trying to print multiple <code>service.names</code> values so they can be printed in a single line separated by comma.</p>
  
  <p>How can i combine the <code>service.name</code> values separated by comma so they print like below:</p>
  
  <pre><code>{
    "number": 1,
    "service name": "FTP-Server, SSH-Server"
  }
  </code></pre>
  
  <p>I tried below in pyjq but it separates values by a complete separate block.</p>
  
  <pre><code>.group[].group[] | { "number": .number, "service name": .service[].name }
  </code></pre>
  
  <p>Here is the output i am getting</p>
  
  <pre><code>{
    "number": 1,
    "service name": "FTP-Server"
  }
  {
    "number": 1,
    "service name": "SSH-Server"
  }
  </code></pre>
  
  <p>Given below same data with/without object-dictionary. I am ok with any format.</p>
  
  <p>JSON file with object-dictionary enabled</p>
  
  <pre><code>{
      "objects-dictionary": [
          {
              "name": "FTP-Server", 
              "port": "21", 
              "type": "service-tcp", 
              "uid": "ef245528-9a3d-11d6-9eaa-3e5a6fdd6a6a"
          }, 
          {
              "name": "SSH-Server", 
              "port": "22", 
              "type": "service-tcp", 
              "uid": "dff4f7ba-9a3d-11d6-91c1-3e5a6fdd5151"
          }
      ], 
      "base": [
          {
             "number": 1, 
              "service": [
                  "ef245528-9a3d-11d6-9eaa-3e5a6fdd6a6a",
                  "dff4f7ba-9a3d-11d6-91c1-3e5a6fdd5151"
              ],
              "uid": "90088436-ac42-4363-84a6-3dbebf3c11f0"
          }
      ]
  }
  </code></pre>
  
  <p>JSON file without object-dictionary</p>
  
  <pre><code>{
      "group": [
          {
              "group": [
                  { 
                      "number": 1, 
                      "service": [
                          {
                              "name": "FTP-Server", 
                              "port": "21", 
                              "type": "service-tcp", 
                              "uid": "ef245528-9a3d-11d6-9eaa-3e5a6fdd6a6a"
                          }, 
                          {
                              "name": "SSH-Server", 
                              "port": "22", 
                              "type": "service-tcp", 
                              "uid": "dff4f7ba-9a3d-11d6-91c1-3e5a6fdd5151"
                          }
                      ], 
                      "uid": "90088436-ac42-4363-84a6-3dbebf3c11f0"
                  }
              ]
          }
      ]
  }
  </code></pre>