top of page
  • Writer's pictureTim Burns

Python JSON: A simple JSON application with Big Goals

The joy of developing large scale apps comes from following this process

  1. Create small abstractions that hide complexity

  2. Build components that encapsulate those small abstractions

  3. Assemble the components into a large scale application

In this example, I start with a very simple application of parsing JSON. I do so using the same infrastructure I will eventually use for a large-scale application that illustrates how to build commercial-grade software on AWS.

I love JSON (and other markup languages) because it lets you focus on the abstraction of task when you are running it, yet it is flexible enough to describe anything you can imagine.

In this example, I will implement a python program that parses a JSON file and tests the result is correct.

Step 0: Download the Prerequisites

Any significant project should be driven programatically. For that reason, I have bundled this code into a git project with a makefile as talking_awsdk. Download and run make test. The successful execution will show the test is successful.

Step 1: Write a Test

Because we are not hacks, we start with a test. Create a folder in the idea and call it "test" and create a file "". This test will cover two use cases: parse JSON from a local file and parse JSON remotely on S3.

Start with a local test to load the table of contents code from my previous blog post locally.

def test_configure_json(self): result = awsdk.configure_json("terraform/s3/json-files/table_of_contents.json")

Yes, I am glossing over a lot here. I haven't discussed the makefile, the awsdk library, and some wrapper code is missing, but the purpose of calling this out, that you NEED to write your tests first. I cannot overemphasize this. It's all about small details becoming a grand design. When those small details become the grand design, then you will have all the pieces in place to keep that grand design together at it evolves.

Step 2: Make that Test Work

So the logic to configure JSON is very straight-forward in Python.

with open(json_file) as json_file: data = json.load(json_file)

Implement that logic and your test will pass.

17 views0 comments

Recent Posts

See All

Carto, Snowflake, and Data Management

A basic principle of data management: Don't move data unless you have to. Moving data is expensive and error-prone. Data Egress Cost: How To Take Back Control And Reduce Egress Charges Archiving to S

Music Festivals 2024

I am browsing music festivals I'd like to attend in 2024. I work for which manages vacation properties and my search came up with this site from one of our biggest competitors. Vacasa: US

bottom of page