I am working on a cluster algorithm, and when after it cluster the data, it return the list which contain single document (class doc) and group (class group) of documents, for example:
Group(Document(id='NSVcteD-5', name=u'1332410487000-2ed0728e9015028e7c41341011a1bd82'), Group(Document(id='NSVcteD-11', name=u'1332410485000-18ae371b18b3790874fb886085c770af'), Group(Document(id='NSVcteD-12', name=u'1332410484000-dc544efc146674289b126062b000a302'), Group(Document(id='NSVcteD-6', name=u'1332410487000-25e815a47779642df2a416495bd5174c'), Group(Document(id='NSVcteD-7', name=u'1332410485000-eb66881f5b1c633dd1609ad6fc18a45c'), Group(Document(id='NSVcteD-2', name=u'1332410487000-a39e2076ca4477e8a324081732bd36c0'), Group(Document(id='NSVcteD-9', name=u'1332410485000-db1acc63d72a63f65623610242394877'), Group(Group(Document(id='NSVcteD-13', name=u'1332410152000-13ea7da3c74917b86bb70e59ff356397'), Document(id='NSVcteD-3', name=u'1332410487000-6287c3d86e6416cb421b6f176a367e23')), Group(Document(id='NSVcteD-10', name=u'1332410485000-508937f6a4cae9ed79dbd54f016ca61c'), Group(Document(id='NSVcteD-4', name=u'1332410487000-4b16fa5633a9df1341690d9a32a4f06d'), Group(Document(id='NSVcteD-1', name=u'1332410487000-b6696b10ad4415c87e41e5367fd4bcfa'), Group(Document(id='NSVcteD-8', name=u'1332410485000-e3f77be9cddcb9efc07914654454d817'), Group(Document(id='NSVcteD-14', name=u'1332410151000-cc13783d0980106d686d64082121f6ac'), Document(id='NSVcteD-15', name=u'1332410151000-a91330e828e41ed3b8503f3133f61fc7'))))))))))))))
To make it’s easy to understand, just bring a real obj, generated by my script. It is multi-tered list, and I have no idea how to iterate to manipulate with it, such as convert to the json style string.
Any help is much appreciated.
You mean something like that? Note that this is totally inefficient and will break after a certain depth..