May-06-2020, 12:37 AM
so roughly speaking all the "id" keys are objects in a big array. I have tried various variation of the simple code below but I keep getting TypeError: the JSON object must be str, bytes or bytearray, not TextIOWrapper
import json import os rootfile = r'C:\\Users\\homer\\dumps\\cosmodb-sample.json' with open(rootfile,'r') as file: json_data = json.loads(file) for docs in json_data[0]: print(docs)
Quote:[
{
"id": "company-channelruleprintermap-8913-$pc2$company$8913$uspc02",
"ChannelRuleCollections": [
{
"Name": "Peak",
"State": 0,
"Modified": "2020-01-10T08:34:34.8015346Z"
}
]
},
{
"id": "company-channelruleprintermap-8913-$pc2$company$8913$uspc02",
"ChannelRuleCollections": [
{
"Name": "Peak",
"State": 0,
"Modified": "2020-01-10T08:34:34.8015346Z"
}
]
},
]