dianaoa22 commented on issue #1925: URL: https://github.com/apache/age/issues/1925#issuecomment-2242507126
import json # Original JSON data data = { "root": { "child1": { "name": "test", "location": "test" }, "child2": [ { "child2-class": "classname", "child2-number": 1 } ], "child3": [ { "child4": [ { "child4-pref": 1, "child4-type": "type-schild5" }, { "child4-type": "type-schild5", "child4-pref": 2 } ], "child5": [ { "child5-number": 1, "entryp": { "econtrol": { "ploc": "ploc-10001", "state": "enable" } }, "inside": { "mgmt": { "state": "enable" } } } ], "child3-type": "new-child53", "pref-number": 1 }, { "child3-type": "test-schild5-c", "pref-number": 2, "child4": [ { "child4-pref": 1 }, { "child4-pref": 2 } ], "child5": [ { "entryp": { "econtrol": { "ploc": "ploc-10001", "state": "enable" } }, "child5-number": 1, "inside": { "mgmt": { "state": "enable" } } } ] }, { "child3-type": "new-child53", "pref-number": 3, "child4": [ { "child4-type": "type-schild5", "child4-pref": 1 }, { "child4-type": "type-schild5", "child4-pref": 2 } ], "child5": [ { "inside": { "mgmt": { "state": "enable" } }, "child5-number": 1 } ] }, { "child4": [ { "child4-type": "type-schild5", "child4-pref": 1 }, { "child4-pref": 2, "child4-type": "type-schild5" } ], "child5": [ { "inside": { "mgmt": { "state": "enable" } }, "child5-number": 1 } ], "child3-type": "new-child53", "pref-number": 4 }, { "child3-type": "new-child53", "pref-number": 5, "child4": [ { "child4-pref": 1, "child4-type": "type-schild5" } ], "child5": [ { "inside": { "mgmt": { "state": "enable" }, "band": { "band-no": "NQP-10001" } }, "child5-number": 1 } ] }, { "child4": [ { "child4-type": "type-schild5", "child4-pref": 1 }, { "child4-type": "type-schild5", "child4-pref": 2 } ], "child5": [ { "inside": { "mgmt": { "state": "enable" } }, "child5-number": 1, "entryp": { "econtrol": { "state": "enable", "ploc": "ploc-10001" } } } ], "child3-type": "new-child53", "pref-number": 6 }, { "child3-type": "new-child53", "pref-number": 8, "child4": [ { "child4-type": "type-schild5", "child4-pref": 1 } ], "child5": [ { "inside": { "mgmt": { "state": "enable" }, "net": { "test": "FRL-10001" } }, "child5-number": 1 } ] } ] } } def add_entries(data, num_entries): base_child3 = { "child3-type": "new-child53", "child4": [], "child5": [], "pref-number": None # Will be set dynamically } base_child4 = { "child4-pref": None, # Will be set dynamically "child4-type": "type-schild5" } base_child5 = { "child5-number": None, # Will be set dynamically "entryp": { "econtrol": { "ploc": "ploc-10001", "state": "enable" } }, "inside": { "mgmt": { "state": "enable" } } } # Generate new child3 entries new_child3s = [] for i in range(1, num_entries + 1): child3 = base_child3.copy() child3['pref-number'] = i # Generate child4 entries for the child3 child4_entries = [] for j in range(1, 5): # 4 child4 entries per child3 for example child4 = base_child4.copy() child4['child4-pref'] = j child4_entries.append(child4) child3['child4'] = child4_entries # Generate child5 entries for the child3 child5_entries = [] for j in range(1, 5): # 4 child5 entries per child3 for example child5 = base_child5.copy() child5['child5-number'] = j child5_entries.append(child5) child3['child5'] = child5_entries new_child3s.append(child3) # Add new child3s to the data data['root']['child3'].extend(new_child3s) # Specify the number of entries to add num_entries = 100000 # Add the entries add_entries(data, num_entries) # Print the total number of child3 entries to confirm print(f"Total child3 entries: {len(data['root']['child3'])}") # Optional: Save the updated data to a file with open('big_data.json', 'w') as file: json.dump(data, file, indent=4) print("Data added successfully and saved to updated_data.json") Run this python program to get a big data, I am unable to imprt the json due to size restriction of 25MB -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@age.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org