Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| # lets say this is the response we receive | |
| response = { | |
| "results" => { | |
| "total_count" => 15, | |
| "per_page" => 100, | |
| "companies" => [ | |
| { | |
| "company" => { | |
| "name" => "Foo Bar Ltd", | |
| "registered_address" => { ... }, |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| <!DOCTYPE html> | |
| <head> | |
| <title>Stay Standalone</title> | |
| <meta name="apple-mobile-web-app-capable" content="yes"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
| <script src="stay_standalone.js" type="text/javascript"></script> | |
| </head> | |
| <body> | |
| <ul> | |
| <li><a href="http://google.com/">Remote Link (Google)</a></li> |