Basic JSON Question
-
There is an external json file whose content is in the following format.
{ "Option 1": X, "Option 2": Y, }
When I try to change the whole content of this external file to the following, I get a json error.
What is my systematic mistake here?
const var externalDat = { "Option 1": A, "Option 2": B, "Option 3": C, "Option 4": D, }; inline function CheckOnLoad() { local data = Engine.loadFromJSON("../MyFile.dat"); data = externalDat; Engine.dumpAsJSON(data, "../MyFile.dat"); }
-
@JulesV maybe it's that last comma at the end of your last property, but I figured HISE was mostly resistant to that. Perhaps not on export?
-
-
The error is:
Only objects can be exported as JSON
Also tried
data = trace(externalDat);
still no luck. -
@JulesV whats X and Y?
-
@Christoph-Hart The variables I defined as const variables correspond to color codes in the script.
const White = 0xFFFFFFFF;
So the X is White in the real example.
-
@JulesV start here:
const var externalDat = { "Option 1": A, "Option 2": B, "Option 3": C, "Option 4": D }; inline function CheckOnLoad() { local data = Engine.loadFromJSON("../MyFile.dat");); Console.print(trace(data)); //data = externalDat; //Engine.dumpAsJSON(data, "../MyFile.dat"); }; CheckOnLoad();