This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io
Really simple example of how to build an API with Python and Flask that listens for HTTP requests and spits out JSON. The hard part of all of this is building the JSON with python. For really simple JSON we can just use a dictionary. However, where things get complicated is if you want your JSON objects to contain objects. The work around I’ve found is to simply create a dictionary of dictionaries, where we will use dictionaries instead of objects. In the example below first_category, second_category, and third_category would normally be represented as objects, but have been converted to dictionaries instead: