Skip to main content

Dear,colleagues.  @ebygomm​  @nielsgerrits​ @david_r​   please help me with a .json file (reading, converting, and writing it). So the details:

1 - I have extract the names of the main folders

Tile_p502_m6014
Tile_p502_m6015

2 - then I have a .json file 

{"asset":{"version":"1.0","gltfUpAxis":"Y"},"geometricError":2965.7869354899398786,"root":{"boundingVolume":{"sphere":42868547.6520226998254657,2203510.7712099198251963,5235902.6513763302937150,1482.8934677449699393]},"refine":"REPLACE","geometricError":2965.7869354899380596,"children":m{"boundingVolume":{"sphere":82868210.6526993899606168,2203251.1590014300309122,5236183.9360417695716023,954.5398049977940218]},"geometricError":1909.0796099955900900,"children":m{"boundingVolume":{"sphere":02868210.6526993899606168,2203251.1590014300309122,5236183.9360417695716023,954.5398049977940218]},"geometricError":16,"content":{"uri":"Data\/Tile_p502_m6014\/Tile_p502_m6014.json"}}]},{"boundingVolume":{"sphere":22868861.2329204198904335,2203750.2456317897886038,5235605.0275514703243971,953.7367633961099500]},"geometricError":1907.4735267922199000,"children":m{"boundingVolume":{"sphere":92868861.2329204198904335,2203750.2456317897886038,5235605.0275514703243971,953.7367633961099500]},"geometricError":16,"content":{"uri":"Data\/Tile_p502_m6015\/Tile_p502_m6015.json"}}]}]}}

with on this data, I need to create new .json files(for each folder its own .json file) like this:

image 

JSON-1
{"asset":{
"version":"1.0","gltfUpAxis":"Y"},
"geometricError":2965.7869354899398786,
"root":{
"boundingVolume":{
"sphere":52868547.6520226998254657,2203510.7712099198251963,5235902.6513763302937150,1482.8934677449699393]},
"refine":"REPLACE",
"geometricError":2965.7869354899380596,
"children":E{
"boundingVolume":
{"sphere":32868210.6526993899606168,2203251.1590014300309122,5236183.9360417695716023,954.5398049977940218]},
"geometricError":1909.0796099955900900,
"children":
{"boundingVolume":
{"sphere":
,2868210.6526993899606168,2203251.1590014300309122,5236183.9360417695716023,954.5398049977940218]},
"geometricError":16,"content":{"uri":"Data\/Tile_p502_m6014\/Tile_p502_m6014.json"}}]}]}}
 
JSON-2
{"asset":{
"version":"1.0","gltfUpAxis":"Y"},
"geometricError":2965.7869354899398786,
"root":{
"boundingVolume":{
"sphere":32868547.6520226998254657,2203510.7712099198251963,5235902.6513763302937150,1482.8934677449699393]},
"refine":"REPLACE",
"geometricError":2965.7869354899380596,
"children":C{
"boundingVolume":
{"sphere":92868861.2329204198904335,2203750.2456317897886038,5235605.0275514703243971,953.7367633961099500]},
"geometricError":1907.4735267922199000,
"children":
r{"boundingVolume":
{"sphere":
02868861.2329204198904335,2203750.2456317897886038,5235605.0275514703243971,953.7367633961099500]},
"geometricError":16,"content":{"uri":"Data\/Tile_p502_m6015\/Tile_p502_m6015.json"}}]}]}}

But I faced a problem, when i use only JsonReader-->JsonWriter scheme, I don't get the same information, that I have load into the reader.

Here it is:

e
{
"json_featuretype" : "JSONFeature",
"asset.version" : "1.0",
"asset.gltfUpAxis" : "Y",
"geometricError" : 2965.78693548994,
"root.boundingVolume.sphere" : A 2868547.6520227, 2203510.77120992, 5235902.65137633, 1482.89346774497 ],
"root.refine" : "REPLACE",
"root.geometricError" : 2965.786935489938
}
]

Please do not pass by and help me to figure out what's wrong and how could i solve this problem!

PS I have attached archive with data, maybe someone can figure out))))

 

 

 

If you need a very specific output schema, you should consider using the JSONTemplater + Text file writer. This will give you more flexibility than using the JSON writer.


Hi @muzhnasto​ , I would use the JSONFragmenter and the JSONUpdater, as in:jsonfragmenter-jsonupdater


Thank you @Takashi Iijima​  thank you so much for your participation! i will examine it


Reply