forked from codehouseindia/Python-Programs
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathjson2pcd.py
More file actions
28 lines (18 loc) · 675 Bytes
/
json2pcd.py
File metadata and controls
28 lines (18 loc) · 675 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import json
for count in range(4):
pathIn = "C:\\Users\\Rohit\\Downloads\\jsontry\\" + str(count) +".json"
pathOut = "C:\\Users\\Rohit\\Desktop\\Output\\"+ str(count) +".json"
path_to_input = pathIn
path_to_output = pathOut
with open(path_to_input) as json_file:
data_read =json.loads(json_file.read())
data_write = []
points_json = {}
for pts in data_read['points']:
data = {};
row = str(pts['x']) + " " + str(pts['y']) + " " + str(pts['z']) + " " + str(int(pts['i']))
data = row
data_write.append(data)
with open(path_to_output, 'w') as write_json_file:
json.dump(data_write,write_json_file, indent =4)
print(len(data_read))