I have the following List/Dataframe: [['title1','title1_chapter1','title1_chapter1_section1','title1_chapter1_href1'], ['title1','title1_chapter1','title1_chapter1_section2','title1_chapter1_href2'], ['title1','title1_chapter2','title1_chapter2_section1','title1_chapter2_href1'], ['title1','title1_chapter2','title1_chapter2_section2','title1_chapter2_href2'], ['title2','title2_chapter1','title2_chapter1_section1','title2_chapter1_href1']] I want to transform it to the following nested JSON such that it can be used in bootstrap treeview. [ { "nodes": [ { "nodes": [ { "text": "title1_chapter1_section1", "href":…