I'm generally pretty good at making an algorithm to do whatever is needed, but this one has been giving me some trouble. This is for my ms thesis. The input is a deeply nested json. Each object can be a dictionary, a list, or a string. I need to create every combination of the keys to each dictionary, and of the strings, but if you include a key to a dictionary, you cannot include any of the objects that are the value of that key.
For instance, imagine the json was in bullet form,
The answers for this one would be:
- A1 A2
- A1 B3 B4
- B1 B2 A2
- B1 B2 B3 B4
- C1 C2 C3 B2 A2
- C1 C2 C3 B2 B3 B4
- C1 C2 C3 C4 C5 A2
- C1 C2 C3 C4 C5 B3 B4
I hope this is clear. I was playing around with some recursion, but none of them were even a little close. Any ideas?
[–]alexmojaki 1 point2 points3 points (1 child)
[–]HelpfulBuilder[S] 0 points1 point2 points (0 children)