Hi, I need exactly the same thing - reading-writing json files from/to maxscript data (dictionary of strings, floats and arrays)
I could read/write using python only:
import json
fileIN = open ("D:\\TMP2\\original.json", "r")
pythonData = json.loads(fileIN.read())
fileIN.close()
fileOUT = open ("D:\\TMP2\\new.json", "w")
fileOUT.write(json.dumps(pythonData, indent=4))
fileOUT.close()
But this would result in a python dictionary; my question is how to have this as maxscript data.
I am trying to use
json = python.import #json
but unfortunately I have no knowledge of python.
It would be awesome if someone could help me get this working inside maxscript!
MANY THANKS!
PS this is the json file I am trying to read/write as maxscript dictionary / arrays
{
"NumTextures": 2,
"Positions": [
[-0.19283, 0.00000, 26.94215],
[0.19282, 0.00000, -26.94215]
],
"Cameras": [
[360, 180, [-0.19283, 0.00000, 26.94215], [-0.19283, 0.00000, 25.94215], [0.00000, 1.00000, 0.00000], "color0", "enabled"],
[360, 180, [0.19282, 0.00000, -26.94215], [0.19282, 0.00000, -27.94215], [0.00000, 1.00000, 0.00000], "color1", "enabled"]
],
"InitialPosition": [-70.14005, 0.00000, 53.26647],
"InitialRotation": 0,
"NumNearCameras": 2,
"NumWideCameras": 2,
"BackColorFactorA": 20.0,
"BackColorFactorB": 0.1,
"BackRotation": 0
}