Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
Qt Creator 11.0.1
-
None
Description
in JavaScript, it is possible to create object simply with "{ }". the format of object is similar to a map
property var obj: { "key1": value1", "key2": value2" } console.log(JSON.stringify(obj))
But sometime, you need not only the value to be a variable but also the key. It's possible to do it with [...] directly in the object
property string key1: "property_name_1" property string key2: "property_name_2" property var obj: { [key1]: value1", [key2]: value2" } console.log(JSON.stringify(obj))
But when you format the file, the [ ... ] will be replace by " ... " giving the wrong key