I have some json that I have converted to a list in Python like this:
jsonText = '[{"stationID":"ABCD1234","obsTimeUtc":"2021-05-04T11:53:04Z","obsTimeLocal":"2021-05-04 21:53:04","neighborhood":"HelloWorld","softwareType":"SoftwareHelloWorld","country":"Hello","solarRadiation":0.0,"lon":1234.1234,"realtimeFrequency":null,"epoch":12345678,"lat":1234.1234,"uv":0.0,"winddir":1234,"humidity":1234,"qcStatus":1,"imperial":{"temp":57,"heatIndex":57,"dewpt":56,"windChill":57,"windSpeed":0,"windGust":0,"pressure":29.95,"precipRate":0.07,"precipTotal":0.21,"elev":56}}]' listText = js.loads(jsonText) print('--NEW FORMAT--') print(listText)
Which returns this list:
[{'stationID': 'ABCD1234', 'obsTimeUtc': '2021-05-04T11:53:04Z', 'obsTimeLocal': '2021-05-04 21:53:04', 'neighborhood': 'HelloWorld', 'softwareType': 'SoftwareHelloWorld', 'country': 'Hello', 'solarRadiation': 0.0, 'lon': 1234.1234, 'realtimeFrequency': None, 'epoch': 12345678, 'lat': 1234.1234, 'uv': 0.0, 'winddir': 1234, 'humidity': 1234, 'qcStatus': 1, 'imperial': {'temp': 57, 'heatIndex': 57, 'dewpt': 56, 'windChill': 57, 'windSpeed': 0, 'windGust': 0, 'pressure': 29.95, 'precipRate': 0.07, 'precipTotal': 0.21, 'elev': 56}}]
However I don't want the keys in the list (stationID:. obsTimeUtc: etc.), only the values so that it would look more like this:
[["ABCD1234","2021-05-04T11:53:04Z","2021-05-04 21:53:04","HelloWorld","SoftwareHelloWorld","Hello",0.0,1234.1234,"null",12345678,1234.1234,0.0,1234,1234,1,57,57,56,57,0,0,29.95,0.07,0.21,56]]
How do I remove the "keys" in the list and just keep the values?
https://stackoverflow.com/questions/67394703/how-do-you-remove-json-keys-from-a-list-in-python May 05, 2021 at 11:12AM
没有评论:
发表评论