title: How can I do such transformation?
body: <p>env: spark2.4.5</p>
  
  <h1>source.json:</h1>
  
  <pre><code>{
      "a_key": "1",
      "a_pro": "2",
      "a_con": "3",
      "b_key": "4",
      "b_pro": "5",
      "b_con": "6",
      "c_key": "7",
      "c_pro": "8",
      "c_con": "9",
      ...
  }
  </code></pre>
  
  <h1>traget.json:</h1>
  
  <pre><code>{
      "factors": [
          {
              "name": "a",
              "key": "1",
              "pros": "2",
              "cons": "3"
          },
          {
              "name": "b",
              "key": "4",
              "pros": "5",
              "cons": "6"
          },
          {
              "name": "c",
              "key": "7",
              "pros": "8",
              "cons": "9"
          },
          ...
      ]
  }
  </code></pre>
  
  <p>As you can see the target 'name' is a part of key of sources. For instance, 'a' is the 'name' of 'a_key', 'a_pro', 'a_con'. I really don't know how to extract a value from key, and do some 'group by' transforming. Can anybody give me some suggestion?</p>