I am trying to load a text file formatted as JSON using the below code
with open('orderdata/ETHUSDTorder.txt') as json_file:
data = json.load(json_file)
actualdata=data['average']
print(actualdata)
print("read complete")
but it gives me below error
Traceback (most recent call last):
File "C:\Users\pavan.alur\PycharmProjects\pythonProject\main.py", line 30, in <module>
data = json.load(json_file)
File "C:\Users\pavan.alur\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 293, in load
return loads(fp.read(),
File "C:\Users\pavan.alur\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\pavan.alur\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\pavan.alur\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 2 column 5 (char 6)
Below is my text file
{
'info': {
'symbol': 'ETHUSD',
'orderid': '20556566',
'orderlistid': '-1',
'clientorderid': 'TXgguEidjfF9eLKF',
'transactiontime': '1619882734',
'price': '0.00',
'origqty': '0.00500',
'executedQty': '0.005000',
'commutativeQuoteQty': '143.06',
'status': 'Filled',
'timeInforce': 'GTC',
'type': 'MARKET',
'side': 'buy',
'fills': [{
'price': '2861.34',
'qty': '0.030',
'comission': '0.0001',
'comissionAsset': 'BNB',
'tradeid': '5722834'
}, {
'price': '2761.23',
'qty': '0.019',
'comission': '0.0001',
'comissionAsset': 'BNB',
'tradeid': '5722834'
}]
},
'id': '2044343',
'clientorderid': 'TXgguEidjfF9eLKF',
'timestamp': '1619882734',
'datetime': '2021-06-10T20:21:234',
'lasttradetimestamp': None,
'symbol': 'ETHUSD',
'type': 'MARKET',
'timeInforce': 'GTC',
'postonly': 'false',
'side': 'buy',
'price': '2861.23',
'stopprice': 'None',
'amount': 0.05,
'cost': 143.06,
'average': 2861.23,
'filled': 0.05,
'remaining': 0.0,
'status': 'closed',
'fee': {
'cost': 0.00013,
'currency': 'BNB'
},
'trades': [{
'info': {
'price': '2861.17',
'qty': '0.0330',
'comission': '0.0001',
'commissionAsset': 'BNB',
'tradeid': '2383487'
},
'timestamp': None,
'datetime': None,
'symbol': 'ETHUSD',
'id': None,
'order': None,
'type': None,
'side': None,
'takerOrMaker': None,
'price': 2861.23,
'amount': 0.034,
'cost': 87.534,
'fee': {
'cost': 0.0034,
'currency': 'BNB'
}
}, {
'info': {
'price': '2861.23',
'qty': '0.0019',
'comission': '0.0023',
'comissionAsset': 'BNB',
'tradeid': '453233'
},
'timestamp': None,
'datetime': None,
'symbol': 'ETHUSD',
'id': None,
'order': None,
'type': None,
'side': None,
'takerOrMaker': None,
'price': 2861.39,
'amount': 0.01941,
'cost': 55.53,
'fee': {
'cost': 6.737,
'currency': 'BNB'
}
}]
}
I am trying to get the "average" value and the JSON response is received from binance api
The response is received using ccxt library and I am trying to print the order that got executed and save the response in json format in text file Any help would be appreciated
I am a bit new to the python so please bear with me here
Thanks in advance. Have a great day :)
You need double-quotes for it to be valid JSON.
There are JSON validator and beautification web sites you can try.
jsonlint.com is one of them, for example.
I got it. Thanks, Ben for helping I just had to use dump to format everything and then load works perfectly. Silly me Thanks all for the help and have a great day ahead :)
Related
I am an absolute beginner with Python (the title probably says it already).I usually look for the answers with googling, but here I don't even know what term to look for.... I have a long string in a variable, which I suppose will be easily converted to a table, only I can't figure out how to do it myself
This is my example:
#pip install pycoingecko
from pycoingecko import CoinGeckoAPI
cg = CoinGeckoAPI()
output = cg.get_search_trending()
print(output)
This is the output:
{'coins': [{'item': {'id': 'metavpad', 'coin_id': 21397, 'name': 'MetaVPad', 'symbol': 'METAV', 'market_cap_rank': 511, 'thumb': 'https://assets.coingecko.com/coins/images/21397/thumb/metav.png?1639044315', 'small': 'https://assets.coingecko.com/coins/images/21397/small/metav.png?1639044315', 'large': 'https://assets.coingecko.com/coins/images/21397/large/metav.png?1639044315', 'slug': 'metavpad', 'price_btc': 7.777707600278187e-06, 'score': 0}}, {'item': {'id': 'syscoin', 'coin_id': 119, 'name': 'Syscoin', 'symbol': 'SYS', 'market_cap_rank': 189, 'thumb': 'https://assets.coingecko.com/coins/images/119/thumb/Syscoin.png?1560401261', 'small': 'https://assets.coingecko.com/coins/images/119/small/Syscoin.png?1560401261', 'large': 'https://assets.coingecko.com/coins/images/119/large/Syscoin.png?1560401261', 'slug': 'syscoin', 'price_btc': 1.3905286168359925e-05, 'score': 1}}, {'item': {'id': 'rainbowtoken', 'coin_id': 17828, 'name': 'RainbowToken', 'symbol': 'RAINBOWTOKEN', 'market_cap_rank': 907, 'thumb': 'https://assets.coingecko.com/coins/images/17828/thumb/WsLiOeJ.png?1637337787', 'small': 'https://assets.coingecko.com/coins/images/17828/small/WsLiOeJ.png?1637337787', 'large': 'https://assets.coingecko.com/coins/images/17828/large/WsLiOeJ.png?1637337787', 'slug': 'rainbowtoken', 'price_btc': 5.831112758941096e-13, 'score': 2}}, {'item': {'id': 'railgun', 'coin_id': 16840, 'name': 'Railgun', 'symbol': 'RAIL', 'market_cap_rank': 534, 'thumb': 'https://assets.coingecko.com/coins/images/16840/thumb/railgun.jpeg?1625322775', 'small': 'https://assets.coingecko.com/coins/images/16840/small/railgun.jpeg?1625322775', 'large': 'https://assets.coingecko.com/coins/images/16840/large/railgun.jpeg?1625322775', 'slug': 'railgun', 'price_btc': 3.1094468809624446e-05, 'score': 3}}, {'item': {'id': 'wonderland', 'coin_id': 18126, 'name': 'Wonderland', 'symbol': 'TIME', 'market_cap_rank': 113, 'thumb': 'https://assets.coingecko.com/coins/images/18126/thumb/time.PNG?1630621941', 'small': 'https://assets.coingecko.com/coins/images/18126/small/time.PNG?1630621941', 'large': 'https://assets.coingecko.com/coins/images/18126/large/time.PNG?1630621941', 'slug': 'wonderland', 'price_btc': 0.08713452772286424, 'score': 4}}, {'item': {'id': 'gods-unchained', 'coin_id': 17139, 'name': 'Gods Unchained', 'symbol': 'GODS', 'market_cap_rank': 274, 'thumb': 'https://assets.coingecko.com/coins/images/17139/thumb/10631.png?1635718182', 'small': 'https://assets.coingecko.com/coins/images/17139/small/10631.png?1635718182', 'large': 'https://assets.coingecko.com/coins/images/17139/large/10631.png?1635718182', 'slug': 'gods-unchained', 'price_btc': 0.00014524078849750436, 'score': 5}}, {'item': {'id': 'altura',
'coin_id': 15127, 'name': 'Altura', 'symbol': 'ALU', 'market_cap_rank': 456, 'thumb': 'https://assets.coingecko.com/coins/images/15127/thumb/ALU_logo_200x200.png?1626868890', 'small': 'https://assets.coingecko.com/coins/images/15127/small/ALU_logo_200x200.png?1626868890', 'large': 'https://assets.coingecko.com/coins/images/15127/large/ALU_logo_200x200.png?1626868890', 'slug': 'altura', 'price_btc': 3.302478861283615e-06, 'score': 6}}], 'exchanges': []}
Now how can I convert this to export it to a CSV? Or what keywords do I have to search for?
You can try something like this, to put everything in 'coins' to a dataframe:
import pandas as pd
from pycoingecko import CoinGeckoAPI
cg = CoinGeckoAPI()
output = cg.get_search_trending()
tab = pd.concat([pd.DataFrame(i) for i in output['coins']],axis=1).T
tab.index = range(tab.shape[0])
The data frame looks like this:
coin_id id ... symbol thumb
0 21397 metavpad ... METAV https://assets.coingecko.com/coins/images/2139...
1 119 syscoin ... SYS https://assets.coingecko.com/coins/images/119/...
2 17828 rainbowtoken ... RAINBOWTOKEN https://assets.coingecko.com/coins/images/1782...
3 16840 railgun ... RAIL https://assets.coingecko.com/coins/images/1684...
4 10354 insure ... SURE https://assets.coingecko.com/coins/images/1035...
5 18126 wonderland ... TIME https://assets.coingecko.com/coins/images/1812...
6 17139 gods-unchained ... GODS https://assets.coingecko.com/coins/images/1713...
You can write it to a csv:
tab.to_csv("results.csv")
I am pulling from an API in URL, and keep getting string indices must be integers error code thrown in python. I am wondering how to fix this? (The url is replaced with "url").
import urllib.request
import json
link = "url"
f = urllib.request.urlopen(link)
data = f.read()
print (str(data, 'utf-8'))
weather = json.loads(data)
print('/n')
print(weather["name"]["temp"])
Here's a sample of the json data:
{"coord":{"lon":-94.2166,"lat":36.4676},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"base":"stations","main":{"temp":262.83,"feels_like":255.36,"temp_min":262.04,"temp_max":263.71,"pressure":1025,"humidity":92},"visibility":10000,"wind":{"speed":6.17,"deg":30},"clouds":{"all":90},"dt":1613195709,"sys":{"type":1,"id":5695,"country":"US","sunrise":1613135272,"sunset":1613174070},"timezone":-21600,"id":0,"name":"Bella Vista","cod":200}
Here is the data snippet you shared formatted in a way that it makes it easier to see what is going on. As you can see, while weather["name"] is valid, weather["name"]["temp"] is not, and that is what is producing the error you are seeing. Instead, weather["main"]["temp"] will display the temperature value in that dictionary.
weather = {'base': 'stations',
'clouds': {'all': 90},
'cod': 200,
'coord': {'lat': 36.4676, 'lon': -94.2166},
'dt': 1613195709,
'id': 0,
'main': {'feels_like': 255.36,
'humidity': 92,
'pressure': 1025,
'temp': 262.83,
'temp_max': 263.71,
'temp_min': 262.04},
'name': 'Bella Vista',
'sys': {'country': 'US',
'id': 5695,
'sunrise': 1613135272,
'sunset': 1613174070,
'type': 1},
'timezone': -21600,
'visibility': 10000,
'weather': [{'description': 'light snow',
'icon': '13n',
'id': 600,
'main': 'Snow'}],
'wind': {'deg': 30, 'speed': 6.17}}
I have the following huge output from the code :urllib.request.urlopen("https://api...").read()
This looks like a JSON object but it is a bytes object. I am looking into on data into this whole. I am not sure how parse all these nested dictionary. Any help would be appreciated. I want to extract the value 112242287903649 located around the end.
b'{"address":"0x4264422fa4c1e60c2ee10d19549c0775fe544d7c","ETH":{"balance":39234.92760140797,"price":{"rate":406.0918669863694,"diff":3.33,"diff7d":7.19,"ts":1603860182,"marketCapUsd":45964513524.05101,"availableSupply":113187476.1865,"volume24h":14765115042.093159,"diff30d":14.028844201369225}},"countTxs":7,"tokens":[{"tokenInfo":{"address":"0x0d4b4da5fb1a7d55e85f8e22f728701ceb6e44c9","name":"DigiMax","decimals":"18","symbol":"DGMT","totalSupply":"1000000000000000000000000000","owner":"0x","lastUpdated":1603831313,"issuancesCount":0,"holdersCount":1042,"description":"DigiMax (DGMT) is a de-centralized Currency on ETHEREUM NETWORK. It is trustless, non-custodial, Layer-2 scaling solution for transferring value on Ethereum. It is Open Source. Community oriented and powered to maximize the power of the blockchain technology","website":"https://digimaxtoken.io/","twitter":"DigiMax_DGMT","image":"/images/DGMT0d4b4da5.png","telegram":"https://t.me/DigiMaxToken","reddit":"DigiMax_DGMT","coingecko":"digimax","price":{"rate":1.218303675e-5,"diff":3.55,"diff7d":-87.33,"ts":1603860187,"marketCapUsd":0,"availableSupply":0,"volume24h":0.36549128,"diff30d":-99.95948266499424,"currency":"USD"}},"balance":3.9e+19,"totalIn":0,"totalOut":0},{"tokenInfo":{"address":"0x28cb7e841ee97947a86b06fa4090c8451f64c0be","name":"YF Link","decimals":"18","symbol":"YFL","totalSupply":"52000000000000000000000","owner":"0x","lastUpdated":1603851830,"issuancesCount":0,"holdersCount":5164,"image":"/images/YFL28cb7e84.png","website":"https://yflink.io/","telegram":"https://t.me/YFLinkGroup","twitter":"YFLinkio","coingecko":"yflink","price":{"rate":411.62315709142763,"diff":2.44,"diff7d":22.67,"ts":1603860243,"marketCapUsd":20628385.985420085,"availableSupply":50114.73633112,"volume24h":673808.77973096,"diff30d":-9.745291974110742,"currency":"USD"},"publicTags":["Yield Farming","Yearn","Governance"]},"balance":69000000000000,"totalIn":0,"totalOut":0},{"tokenInfo":{"address":"0x618e75ac90b12c6049ba3b27f5d5f8651b0037f6","name":"QASH","decimals":"6","symbol":"QASH","totalSupply":"1000000000000000","owner":"0x9fa8a9cd0bd7cbfc503513bc94cd3b3a9ca90e35","lastUpdated":1603818056,"issuancesCount":0,"holdersCount":13087,"website":"https://liquid.plus/","facebook":"LiquidGlobal","telegram":"https://t.me/QUOINENews","twitter":"Liquid_Global","image":"/images/QASH618e75ac.jpeg","reddit":"liquid","coingecko":"qash","ethTransfersCount":2,"price":{"rate":0.03783789848158,"diff":2.83,"diff7d":0.05,"ts":1603860243,"marketCapUsd":13243264.468553,"availableSupply":350000000,"volume24h":170565.95092274,"diff30d":-5.421371004476654,"currency":"USD"},"publicTags":["Exchange"]},"balance":112242287903649,"totalIn":0,"totalOut":0},{"tokenInfo":{"address":"0x9f7229af0c4b9740e207ea283b9094983f78ba04","decimals":"18","name":"Tadpole","owner":"0x","symbol":"TAD","totalSupply":"1000000000000000000000000","lastUpdated":1603859098,"issuancesCount":0,"holdersCount":597,"price":false},"balance":100000000000000,"totalIn":0,"totalOut":0}]}'
The in built json module is perfectly capable of parsing byte strings-
import json
response = urllib.request.urlopen("https://api/endpoint").read()
jsondat = json.loads(response)
Now you can use jsondat however you'd like and extract whichever nested property you desire.
Note that you can also use the requests module, though you absolutely don't have to in this case, to achieve this a bit more simply-
import requests
jsondat = requests.get("https://api/endpoint").json()
Doing json.loads on your given byte string yields-
{'address': '0x4264422fa4c1e60c2ee10d19549c0775fe544d7c',
'ETH': {'balance': 39234.92760140797,
'price': {'rate': 406.0918669863694,
'diff': 3.33,
'diff7d': 7.19,
'ts': 1603860182,
'marketCapUsd': 45964513524.05101,
'availableSupply': 113187476.1865,
'volume24h': 14765115042.093159,
'diff30d': 14.028844201369225}},
'countTxs': 7,
'tokens': [{'tokenInfo': {'address': '0x0d4b4da5fb1a7d55e85f8e22f728701ceb6e44c9',
'name': 'DigiMax',
'decimals': '18',
'symbol': 'DGMT',
'totalSupply': '1000000000000000000000000000',
'owner': '0x',
'lastUpdated': 1603831313,
'issuancesCount': 0,
'holdersCount': 1042,
'description': 'DigiMax (DGMT) is a de-centralized Currency on ETHEREUM NETWORK. It is trustless, non-custodial, Layer-2 scaling solution for transferring value on Ethereum. It is Open Source. Community oriented and powered to maximize the power of the blockchain technology',
'website': 'https://digimaxtoken.io/',
'twitter': 'DigiMax_DGMT',
'image': '/images/DGMT0d4b4da5.png',
'telegram': 'https://t.me/DigiMaxToken',
'reddit': 'DigiMax_DGMT',
'coingecko': 'digimax',
'price': {'rate': 1.218303675e-05,
'diff': 3.55,
'diff7d': -87.33,
'ts': 1603860187,
'marketCapUsd': 0,
'availableSupply': 0,
'volume24h': 0.36549128,
'diff30d': -99.95948266499424,
'currency': 'USD'}},
'balance': 3.9e+19,
'totalIn': 0,
'totalOut': 0},
{'tokenInfo': {'address': '0x28cb7e841ee97947a86b06fa4090c8451f64c0be',
'name': 'YF Link',
'decimals': '18',
'symbol': 'YFL',
'totalSupply': '52000000000000000000000',
'owner': '0x',
'lastUpdated': 1603851830,
'issuancesCount': 0,
'holdersCount': 5164,
'image': '/images/YFL28cb7e84.png',
'website': 'https://yflink.io/',
'telegram': 'https://t.me/YFLinkGroup',
'twitter': 'YFLinkio',
'coingecko': 'yflink',
'price': {'rate': 411.62315709142763,
'diff': 2.44,
'diff7d': 22.67,
'ts': 1603860243,
'marketCapUsd': 20628385.985420085,
'availableSupply': 50114.73633112,
'volume24h': 673808.77973096,
'diff30d': -9.745291974110742,
'currency': 'USD'},
'publicTags': ['Yield Farming', 'Yearn', 'Governance']},
'balance': 69000000000000,
'totalIn': 0,
'totalOut': 0},
{'tokenInfo': {'address': '0x618e75ac90b12c6049ba3b27f5d5f8651b0037f6',
'name': 'QASH',
'decimals': '6',
'symbol': 'QASH',
'totalSupply': '1000000000000000',
'owner': '0x9fa8a9cd0bd7cbfc503513bc94cd3b3a9ca90e35',
'lastUpdated': 1603818056,
'issuancesCount': 0,
'holdersCount': 13087,
'website': 'https://liquid.plus/',
'facebook': 'LiquidGlobal',
'telegram': 'https://t.me/QUOINENews',
'twitter': 'Liquid_Global',
'image': '/images/QASH618e75ac.jpeg',
'reddit': 'liquid',
'coingecko': 'qash',
'ethTransfersCount': 2,
'price': {'rate': 0.03783789848158,
'diff': 2.83,
'diff7d': 0.05,
'ts': 1603860243,
'marketCapUsd': 13243264.468553,
'availableSupply': 350000000,
'volume24h': 170565.95092274,
'diff30d': -5.421371004476654,
'currency': 'USD'},
'publicTags': ['Exchange']},
'balance': 112242287903649,
'totalIn': 0,
'totalOut': 0},
{'tokenInfo': {'address': '0x9f7229af0c4b9740e207ea283b9094983f78ba04',
'decimals': '18',
'name': 'Tadpole',
'owner': '0x',
'symbol': 'TAD',
'totalSupply': '1000000000000000000000000',
'lastUpdated': 1603859098,
'issuancesCount': 0,
'holdersCount': 597,
'price': False},
'balance': 100000000000000,
'totalIn': 0,
'totalOut': 0}]}
My Python script connects to an API and gets some JSON.
I've been trying out prettyprint, parse, loads, dumps but I haven't figured them out yet...
Right now, when i do print(request.json()) I get this:
{'info': {'status': 'OK', 'time': {'seconds': 0.050006151199341, 'human': '50 milliseconds'}},
'datalist': {'total': 1, 'count': 1, 'offset': 0, 'limit': 3, 'next': 1, 'hidden': 0, 'loaded': True, 'list': [
{'id': 27862209, 'name': 'Fate/Grand Order', 'package': 'com.xiaomeng.fategrandorder',
'uname': 'komoe-game-fate-go', 'size': 49527668,
'icon': 'http://pool.img.xxxxx.com/msi8/9b58a48638b480c17135a10810374bd6_icon.png',
'graphic': 'http://pool.img.xxxxx.com/msi8/3a240b50ac37a9824b9ac99f1daab8c8_fgraphic_705x345.jpg',
'added': '2017-05-20 10:54:53', 'modified': '2017-05-20 10:54:53', 'updated': '2018-02-12 12:35:51',
'uptype': 'regular', 'store': {'id': 750918, 'name': 'msi8',
'avatar': 'http://pool.img.xxxxx.com/msi8/c61a8cfe9f68bfcfb71ef59b46a8ae5d_ravatar.png',
'appearance': {'theme': 'grey',
'description': '❤️ Welcome To Msi8 Store & My Store Will Mostly Be Specialized in Games With OBB File Extension. I Hope You Find What You Are Looking For Here ❤️'},
'stats': {'apps': 20776, 'subscribers': 96868, 'downloads': 25958359}},
'file': {'vername': '1.14.5', 'vercode': 52, 'md5sum': 'xxxxx', 'filesize': 49527668,
'path': 'http://pool.apk.xxxxx.com/msi8/com-xiaomeng-fategrandorder-52-27862209-32a264b031d6933514970c43dea4191f.apk',
'path_alt': 'http://pool.apk.xxxxx.com/msi8/alt/Y29tLXhpYW9tZW5nLWZhdGVncmFuZG9yZGVyLTUyLTI3ODYyMjA5LTMyYTI2NGIwMzFkNjkzMzUxNDk3MGM0M2RlYTQxOTFm.apk',
'malware': {'rank': 'UNKNOWN'}},
'stats': {'downloads': 432, 'pdownloads': 452, 'rating': {'avg': 0, 'total': 0},
'prating': {'avg': 0, 'total': 0}}, 'has_versions': False, 'obb': None,
'xxxxx': {'advertising': False, 'billing': False}}]}}
But I want it to look like this:
>>> import json
>>> a={"some":"json", "a":{"b":[1,2,3,4]}}
>>> print(json.dumps(a, indent=4, sort_keys=True))
{
"a": {
"b": [
1,
2,
3,
4
]
},
"some": "json"
}
I am trying to re-arrange the contents of a nested dictionaries where it will check the value of a specified key.
dict_entries = {
'entries': {
'AzP746r3Nl': {
'uniqueID': 'AzP746r3Nl',
'index': 2,
'data': {'comment': 'First Plastique Mat.',
'created': '17/01/19 10:18',
'project': 'EMZ',
'name': 'plastique_varA',
'version': '1'},
'name': 'plastique_varA',
'text': 'plastique test',
'thumbnail': '/Desktop/mat/plastique_varA/plastique_varA.jpg',
'type': 'matEntry'
},
'Q2tch2xm6h': {
'uniqueID': 'Q2tch2xm6h',
'index': 0,
'data': {'comment': 'Camino from John Inds.',
'created': '03/01/19 12:08',
'project': 'EMZ',
'name': 'camino_H10a',
'version': '1'},
'name': 'camino_H10a',
'text': 'John Inds : Camino',
'thumbnail': '/Desktop/chips/camino_H10a/camino_H10a.jpg',
'type': 'ChipEntry'
},
'ZeqCFCmHqp': {
'uniqueID': 'ZeqCFCmHqp',
'index': 1,
'data': {'comment': 'Prototype Bleu.',
'created': '03/01/19 14:07',
'project': 'EMZ',
'name': 'bleu_P23y',
'version': '1'},
'name': 'bleu_P23y',
'text': 'Bleu : Prototype',
'thumbnail': '/Desktop/chips/bleu_P23y/bleu_P23y.jpg',
'type': 'ChipEntry'
}
}
}
In my above nested dictionary example, I am trying to check it by the name and created key (2 functions each) and once it has been sorted, the index value will be updated accordingly as well...
Even so, I am able to query for the values of the said key(s):
for item in dict_entries.get('entries').values():
#The key that I am targetting at
tar_key = item['name']
but this is returning me the value of the name key and I am unsure on my next step as I am trying to sort by the value of the name key and capturing + re-arranging all the contents of the nested dictionaries.
This is my desired output (if checking by name):
{'entries': {
'ZeqCFCmHqp': {
'uniqueID': 'ZeqCFCmHqp',
'index': 1,
'data': {'comment': 'Prototype Bleu.',
'created': '03/01/19 14:07',
'project': 'EMZ',
'name': 'bleu_P23y',
'version': '1'},
'name': 'bleu_P23y',
'text': 'Bleu : Prototype',
'thumbnail': '/Desktop/chips/bleu_P23y/bleu_P23y.jpg',
'type': 'ChipEntry'
}
'Q2tch2xm6h': {
'uniqueID': 'Q2tch2xm6h',
'index': 0,
'data': {'comment': 'Camino from John Inds.',
'created': '03/01/19 12:08',
'project': 'EMZ',
'name': 'camino_H10a',
'version': '1'},
'name': 'camino_H10a',
'text': 'John Inds : Camino',
'thumbnail': '/Desktop/chips/camino_H10a/camino_H10a.jpg',
'type': 'ChipEntry'
},
'AzP746r3Nl': {
'uniqueID': 'AzP746r3Nl',
'index': 2,
'data': {'comment': 'First Plastique Mat.',
'created': '17/01/19 10:18',
'project': 'EMZ',
'name': 'plastique_varA',
'version': '1'},
'name': 'plastique_varA',
'text': 'plastique test',
'thumbnail': '/Desktop/mat/plastique_varA/plastique_varA.jpg',
'type': 'matEntry'
}
}
}