Help for a JSON formatting.
-
I’m a newbie, like almost zero experience in anything like coding, programming etc.
I got a JSON file, Live2D json from a web game to be exact .Snippet. [1,0,0,[["cc.JsonAsset",["_name","json"],1]],[[0,0,1,3]],[[0,"HJhuiyeji.model3",{"Version":3,"FileReferences":{"Moc":"HJhuiyeji.moc3","Physics":"HJhuiyeji.physics3.json","DisplayInfo":"HJhuiyeji.cdi3.json","Textures":["HJhuiyeji.2048/HJhuiyeji.png"
That’s the snippet of the json. When I researched Live2D json format(by looking at some example)
The example { "Version": 3, "FileReferences": { "Moc": "huajia_zhugeliang01.moc3", "Textures": [ "textures/texture_00.png", "textures/texture_01.png"
That’s how the format should be. So I tried and found the JSON Viewer plugin to format the snippet json, and it became like this.
[ 1, 0, 0, [ [ "cc.JsonAsset", [ "_name", "json" ], 1 ] ], [ [ 0, 0, 1, 3 ] ], [ [ 0, "HJhuiyeji.model3", { "Version": 3, "FileReferences": { "Moc": "HJhuiyeji.moc3", "Physics": "HJhuiyeji.physics3.json", "DisplayInfo": "HJhuiyeji.cdi3.json", "Textures": [ "HJhuiyeji.2048/HJhuiyeji.png"
As you can see it gets formatted, but it can’t be read by live2d program unless I remove unnecessary part, that is like everything before “Version”: 3,
So how do I remove these parts and turn it like The Example, which doesn’t have that many white spaces so it can be read by the program.
If anyone can help, I’d be happy.
Note: If this question violate notepad++ rules or etc, let me know I’ll delete it. -
Ordinarily I would recommend JsonTools for this sort of task, but your JSON is a real mess, with arrays that contain a confused jumble of different types, so JsonTools is less useful than it might otherwise be. Likely whatever suggestion I give will only work in this specific situation.
That said, if you open the JsonTools tree view and execute the RemesPath query
@[5][0][2][Version, FileReferences]
, then click theSave query result
button, that would print the JSON you want in a new buffer.There’s lots of RemesPath documentation in the GitHub repo linked above. PythonScript is also a reasonable option for this sort of problem.