Accessing JSON column after reading multiple objects
<p><strong>The Problem</strong></p>

<p>I'm having an issue trying to solve a particular problem, I wish to read in a file that contains multiple json objects and access each object's values at the same time. So far I have it reading the json object in like this:</p>

<pre><code>with open(infile) as file:
    allcontent = []
    for line in file:
        allcontent.append(json.loads(line))
</code></pre>

<p>The contents of the list are simply a json object per item:</p>

<p><code>[{"price": 241, "owner": "brian"}]</code></p>

<p><code>[{"price": 243, "owner": "bob"}]</code></p>

<p>This works and simply appends each json object to the list. However as I wish to calculate for example the highest price across each item in the list I cannot fathom a simple way to perform the operation without a complex loop and assigning variables to track each columns value.</p>

<p>I tried looping over the each json object and accessing the key and value, but I dont want to use this method as it seems like there should be a simpler way to access a column from a list of json objects, specifically for just 1 column of information on each item:</p>

<pre><code>for line in file:
    for key,value in line.items():
        print(key,value)
</code></pre>

<p><strong>Question</strong></p>

<hr>

<p>Using this method does print out each of the rows keys and values, however I need to access all of the rows prices at once to find the highest and lowest. Is there a simpler way than with a loop? such as <code>allcontent['prices']</code></p>

<p><strong>Dictionaries</strong></p>

<p>I attempted to use a dictionary however as updating the dictionary overrides the previously updated content as the keys are identical <code>"prices"</code> for example and would require a number of conditions to test if the new value is higher or lower than the previously updated one.</p>