title: remove duplicates in JSON values using jq
body: <p>I have the following JSON:</p>
  
  <pre><code>[
    {
      "function": "ping",
      "name": "start",
      "servers": [
        {
          "load": 581.6875,
          "last_heard": 2.379324197769165,
          "version": "1.0",
          "hidden": false,
          "pid": "19735"
        },
        {
          "load": 444.0625,
          "last_heard": 1.3227169513702393,
          "version": "1.0",
          "hidden": false,
          "pid": "12092"
        }
      ]
    },
    {
      "function": "pong",
      "name": "middle",
      "servers": [
        {
          "load": 581.6875,
          "last_heard": 2.379324197769165,
          "version": "2.0",
          "hidden": false,
          "pid": "19735"
        },
        {
          "load": 444.0625,
          "last_heard": 1.3227169513702393,
          "version": "3.0",
          "hidden": false,
          "pid": "12092"
        },
        {
          "load": 444.0625,
          "last_heard": 1.3227169513702393,
          "version": "3.0",
          "hidden": false,
          "pid": "12093"
        }
      ]
    },
    {
      "function": "pang",
      "name": "end",
      "servers": [
        {
          "load": 581.6875,
          "last_heard": 2.379324197769165,
          "version": "2.0",
          "hidden": false,
          "pid": "19735"
        },
        {
          "load": 444.0625,
          "last_heard": 1.3227169513702393,
          "version": "2.0",
          "hidden": false,
          "pid": "12092"
        }
      ]
    }
  ]
  </code></pre>
  
  <p>(it's just a sample, it's hundreds of entries)</p>
  
  <p>What I need is to get</p>
  
  <pre><code>[{"name": "start", "version": ["1.0"]},
  {"name": "middle", "version": ["2.0", "3.0"]},
  {"name": "end", "version": ["2.0"]}]
  </code></pre>
  
  <p>So I need to remove useless data and then get a list of names with their unique values for "version".</p>
  
  <p>I can get until the point where I have</p>
  
  <pre><code>{
    "name": "ping",
    "version": [
      "1.0",
      "1.0"
    ]
  }
  {
    "name": "pong",
    "version": [
      "2.0",
      "3.0",
      "3.0"
    ]
  }
  {
    "name": "pang",
    "version": [
      "2.0",
      "2.0"
    ]
  }
  </code></pre>
  
  <p>using </p>
  
  <pre><code>jq '.[] | {name: .function, version: [.servers[].version]}'
  </code></pre>
  
  <p>But I need to get rid of the duplicated values.
  Is this possible using jq?</p>