title: Convert one JSON structure to another
body: <p>I have a problem trying to convert current JSON structure to another:</p>
  
  <pre><code>var data = [
      {"province":"PROVINCEA","city":"CITYA","shopName":"shop name1","address":"shop address1","tel":"phone number1"},
      {"province":"PROVINCEA","city":"CITYA","shopName":"shop name2","address":"shop address2","tel":"phone number2"},
      {"province":"PROVINCEA","city":"CITYB","shopName":"shop name3","address":"shop address3","tel":"phone number3"},
      {"province":"PROVINCEA","city":"CITYB","shopName":"shop name4","address":"shop address4","tel":"phone number4"},
      {"province":"PROVINCEB","city":"CITYC","shopName":"shop name5","address":"shop address5","tel":"phone number5"},
      {"province":"PROVINCEB","city":"CITYC","shopName":"shop name6","address":"shop address6","tel":"phone number6"},
      {"province":"PROVINCEB","city":"CITYD","shopName":"shop name7","address":"shop address7","tel":"phone number7"},
      {"province":"PROVINCEB","city":"CITYD","shopName":"shop name8","address":"shop address8","tel":"phone number8"},
      ]
  </code></pre>
  
  <p>I want convert data to output structure like this.</p>
  
  <p>Here's the snippet with just the result I want to achieve.</p>
  
  <pre><code>var output = {
      "PROVINCEA": {
          "CITYA": {
              "shop name1":{
                  "shop address1": ["phone number1"]
              },
              "shop name2":{
                  "shop address2": ["phone number2"]
              },
          },
          "CITYB": {
              "shop name3":{
                  "shop address3": ["phone number3"]
              },
              "shop name4":{
                  "shop address4": ["phone number4"]
              },
          }
      },
  
      "PROVINCEB": {
          "CITYC": {
              "shop name5":{
                  "shop address1": ["phone number5"]
              },
              "shop name6":{
                  "shop address2": ["phone number6"]
              },
          },
          "CITYD": {
              "shop name7":{
                  "shop address7": ["phone number7"]
              },
              "shop name8":{
                  "shop address8": ["phone number8"]
              },
          }
      }
  
  }
  </code></pre>
  
  <p>Could someone help me in this matter? I've tried for several hours.
  Using lodash or underscore or plain JS is ok.</p>