Hi i have some trouble here, im begineer with python. I want to ask how to parse data from firebase like this one. i want to make this data to be a table. If you have any suggest please reply this [1]: https://i.stack.imgur.com/lToZT.png
Asked
Active
Viewed 39 times
1 Answers
0
You can use JSON lib to decode json
In python code you can make like this:
testStr = '''{
"Value of Pressure": {
"-LeHl495vL6vh-8CaLbD": 0,
"-LeHl6jrhUEMb7slZcpB": 0,
"-LeHl6jrhUEMb7slZcpS": 20.08,
"-LeHl6jrhUEMb7slWcpB": 20.08,
"-LeHl6jrhUEMb9slZcpB": 20.08
}
}'''
parsedJson = json.loads(testStr)
result = [v for v in parsedJson['Value of Pressure'].values()]
print(result)
Result:
[0, 0, 20.08, 20.08, 20.08]
StellaLupus
- 56
- 3
-
can i delete the random name from there too? or i need to change my firebase code first? – yusuf hamzah Apr 18 '22 at 08:38
-
You can delete names in firebase or in python code later. I don't know what will be easier in your case – StellaLupus Apr 18 '22 at 08:48
-
I changed answer. I think it can help you – StellaLupus Apr 18 '22 at 09:03
-
thakns for help – yusuf hamzah Apr 22 '22 at 09:52