0

I am having the following table

country city area population  
   AA    A    Q    50  
   AA    B    R    23
   BB    C    T    200  
   BB    c    Z    10

So, I want to create a JSON file out of it while nesting if parameters are same.
Expected output:

{  
"country":  
{"AA":{  
      "city":{  
        "A":{"area":{"Q":50}},  
        "B":{"area":{"R":23}}
}}},  
"BB":{  
      "city":{  
        "C":{"area":{"Q":50, "Z":10}
}
}}}}   

}

Is there some neat way to do that?
Thank you in advance

0 Answers0