Append string values to list from json object

I am printing year values that I have appended into a list from a json object. My question is how to create a variable representing the list that includes the total collection of the json objects? When I print, i receive a list on each line that includes a new appended object. Again, I would like to have a list that includes all of the values included in the json object.

1 answer

  • answered 2021-02-23 00:14 Kyle Hurst

    j['years'] = []
    if newDate not in j['years']:
         j['years'].append(newDate)