I am trying to generate a nested JSON from a DataFrame, where attributes are distributed in several rows.

This is the format I want. [![what I need][2]][2]
{ "intents" : [ "tag": "Glacier cave", "patterns": ["how are glacier caves formed", "what is glacier cave?", 'give me info on glacier caves',"where is glacier cave formed?"] "responses": ["A partly submerged glacier cave on Perito Moreno Glacier","The ice facade is approximately 60 m high", "A glacier cave is a cave formed within the ice of a glacier", "Glacier caves are often called ice caves , but this term is properly used to describe bedrock caves that contain year-round ice"] ] }