I having array of JSON string, I need to convert it as array of object (i.e., convert the JSON to respective object) without a for loop.
Source Code: (Input data)
data = ['[1,2,3]', '[4,5,6]', '[7,8,9]']
Required Output:
[[1,2,3], [4,5,6], [7,8,9]]
I already using the following solution
import json
data = ['[1,2,3]', '[4,5,6]', '[7,8,9]']
output = []
for item in data:
output.append(json.loads(item))
Currently I'm having a very large number of JSON strings (approx 100K records) and moreover each JSON String array internally contains the record approx 50K. While on execution it takes more than 3GB of RAM for processing.
Note: Implicitly the output is a 2-dim array
[][]. 1st dimension is approx 100K records 2nd dimension contains approx 50K records. Totally 100K * 50K items.
While on conversion it takes more time to convert the JSON (for the above approach). Kindly assist me the idea to convert the JSON string without a for loop.
multiprocessingdataisn't in JSON format?jsonmodule does accept a json list.