17 lines
269 B
Python
17 lines
269 B
Python
import json
|
|
# Create some data
|
|
data ={
|
|
"mat" :[[1,2,3],[4,5,6],[7,8,9]],
|
|
"threshold": 0.5
|
|
}
|
|
|
|
# Write to JSON
|
|
with open( 'data.json', 'w') as f:
|
|
json.dump(data, f)
|
|
|
|
# Read from JSON
|
|
with open( 'data.json', 'r') as f:
|
|
data_read = json. load(f)
|
|
|
|
print (data_read)
|