Q:

How to save information to json as array python

I am making an app in python ad kivy that lets the user enter the time, blood sugar, carbs, and medications taken.  Currently I have information from user input being saved to a TinyDB json file and that does not delete previous information.   However I cannot figure out how to retrieve a specific piece of information.   I would like to know if there is a way to save into the json file as an array or something that can make it easy to retrieve a specific piece of information like the user's last glucose entries only.   Here is my current code. 
.py
def save_entry(self):
    store = JsonStore('entry.json')
    time = self.gt.text
    glucose = self.gr.text
    carbs = self.c.text
    medications_taken = self.mt.text

    db = TinyDB('entry.json')
    User = Query()
    db.insert({'time': time, 'glucose': glucose, 'carbs': carbs, 'medications_taken': medications_taken})

def retrieve(self):
    db = TinyDB('entry.json')
    User = Query()
    with open('entry.json', 'r') as f:
        f = db.search(Query().time ! = 0)[0]
        print f

.kv
<Phone>:

gt: _time
gr: _glucose_reading
c: _food
mt: _meds_taken

       Screen:
            name: 'new_entry'                
            GridLayout:
                cols:1
                BoxLayout:
                    Label:
                        size_hint_x: 0.22
                        bold: True
                        markup: True
                        text: '[size=40][color=0000ff]Time[/color][/size]'
                    TextInput:
                        id: _time
                        hint_text: 'Current Time'

                BoxLayout:
                    Label:
                        size_hint_x: 0.22
                        bold: True
                        markup: True
                        text: '[size=28][color=0000ff]Blood Sugar (mg/dL)[/color][/size]'
                    TextInput:
                        id: _glucose_reading
                        hint_text: 'Current Blood Sugar'

                BoxLayout:
                    Label:
                        size_hint_x: 0.22
                        bold: True
                        markup: True
                        text: '[size=40][color=0000ff]Carbs[/color][/size]'
                    TextInput:
                        id: _food
                        hint_text: 'Total Carbs for meal'

                BoxLayout:
                    Label:
                        size_hint_x: 0.22
                        bold: True
                        markup: True
                        text: '[size=30][color=0000ff]Medications Taken[/color][/size]'
                    TextInput:
                        id: _meds_taken
                        hint_text: 'Please Enter Any Medications Taken'
                    Button:
                        size_hint_x: 0.15
                        text: 'Save'
                        on_press: root.save_entry()

                    Button:
                        size_hint_x: 0.15
                        text: 'Retrieve'
                        on_press: root.retrieve()

A:

Your with inside your retrieve seems redundant.  Maybe this form would be better:
def retrieve(self):
    db = TinyDB('entry.json')
    f = db.search(Query().time ! = 0)[0]
    print f

You asked for an easy way to retrieve the user's most recent glucose value.  Try this:
f = db.search(Query().time ! = 0)[-1]['glucose']
print f

or
f = db.search(Query().time ! = 0)[-1]
print f['glucose']

To retrieve the user's five most recent glucose values:
f=db.search(Query().time ! = 0)[-5:]
print ', '.join(str(x['glucose']) for x in f)

