JSON objects can contain other JSON objects which can contain other JSON objects...Mathemagician wrote:So, other than speed in "large" variable settings, is there anything that JSON does that setStrProp styled coding doesn't do?
You can use encode() to get 2 levels with string props but that is it (and its messy). There are a few JSON functions that are not available to string lists and properties. This is why some of the advanced options to a couple of the functions above can only be done using the JSON argument version of the function.
JSON objects can also store a greater range of characters, so they wont choke where string properties will.
Really if you are starting new macros I would say always go for the JSON path.
er Also the usefulness of json.evaluate() should not be underestimated. You can use it to store skills/powers in a JSON object and perform all the rolls with one call on the current token, then you can pass the resultant object onto another function for formatting etc.
4 - 5 is not going to be much of an issue. But the performance of string lists and string property list does drop off quickly. A foreach() of a string list takes exponentially longer as the list grows O(n^2) JSON array is constant growth per element O(n). The foreach performance is similar for string property list vs JSON object too. For grabbing a random value from the array/list/object/property the string list/property has to iterate through the whole list every time, for the JSON versions this is usually not the case, and will be no worse than the list/string prop if it has to do so.Mathemagician wrote: (And what is large? My string property lists typically contain 4 to 5 variables?)