Mmm, yes, indeed.
I wasn't sure about the acceptability of "." in JSON property names, but it is indeed acceptable. However, to access properties with names containing "." only the
object["propertyWith.Embedded"].subLevelProperty form works, otherwise JS gets confused.
IFF this is worth doing, then I guess the template format could be extended to accept property specifications similarly to JS, examples as follows:
level1 - as before
level1.level2.level3 - specifies value at level3, of 3 level hierarchy
["level1.level2"].level3 - specifies value of level3, of 2 level hierarchy
level1["level2.level3"] - specified value of "level2.level3" of 2 level hierarchy
firstItem,["embedded.item"].level2,level1.level2 - 3 values: a 1st level item, and two 2nd level items
That doesn't break existing working templates, allows the specification of both JSON->CSV and CSV->JSON operations using the same syntax, and follows JS syntax more or less.
Of course, there is then the issue of what about "[" and "]" in property names, so
works, provided the accessing code is of the form
temperature = msg.payload["SHT3X].0x44"].Temperature;
which presumably works because the offending ] is in a string, which the parser accepts.
But I'm not sure this isn't getting too complicated...
Thoughts, anyone? What did I miss?