shinkan
You can't do that kind of thing in any language I know of.
JSON objects (a.k.a. dictionnary or hashtables) are values indexed using a key.
The only way to change the key, for a given value, is, as you did, copying to another key and deleting the previous one.
In javascript it wouldn't be a big deal because you would probably just swap objects references (the new key will point to the same object, hence no copy). But since, in construct2, you don't have access to any value type other than strings and number, it's not possible.
To be clear, you would have that in javascript:
// this creates an empty object
// and put its reference in the variable root
var root = {};
// this creates an object with "name" and "size"
// and put its reference in the "Star1" property of root
root["Star1"] = {"name":"somename","size":"somesize"};
// "Star1" and "Star2" properties point to the same exact object
root["Star2"] = root["Star1"];
// for example:
root["Star1"]["name"] = "plop";
root["Star2"]["name"] == "plop"; // this will return true ("==" means "is equal?")
// then to finish things up, in javascript you would do:
delete root["Star1"];[/code:3clgjt1x]
Now, the closest thing you can do with the current JSON plugin is:[code:3clgjt1x]-> JSON: Set Value at root["Star1"] to "{""name"":""somename"",""size"":""somesize""}"
-> JSON: Load JSON JSON.ToJson(0,"Star1") at root["Star2"] // the copy
-> JSON: delete root["Star1"][/code:3clgjt1x]
as you notice it's almost the same
The only difference is that after the copy (and before the delete) if you modify the object in "Star1", the one in "Star2" will be left untouched because it's not a reference but a copy.
Modifying the key this way is totally fine, but you have to be carefull because copy is slower than just passing references. And going from an object to a JSON string to a new object is even slower than if you just copied each properties one by one. But it's a lot simpler (: