I'm not sure it makes any difference, but are you using $modx->toJSON() and $modx->fromJSON() to do the conversions, or just PHP's functions?
i am using the PHP functions. wasnt aware that there are modx functions available.
i also figured out that. when i am doing it in my Template {{{{{ }}}}} without any JSON. It ll be converted to [ ].
well, i figured out that it is not a problem of the modx core. it seems to be a problem with a module that i am using, presumable pdoTools.
try to disable the fenom-parser in the system-settings
Can you put that directive in the JS file that receives the data?
Also, I wonder if the JSON_FORCE_OBJECT option for json_encode() would help.
well, it is not the js file that recieves the data. it is the data deliverer. so no problem in fact.
the json isn't the problem at all. it is properly generated. coz i am using caching, so i was able to figure out that the return string of the cache file was properly.
just the template parsing seems to be the problem. as i see so far is the problem also when i put the five curly brackets in a template (guess also chunk, but i didnt tried that yet) they will be translated to an opened or closed squared bracket coresponding to the curly brackets.
I'm not sure what your flow is, but maybe you could use some other symbol there and translate it before it's used. Another option might be to escape it ( \} ) or quote it (or quote the whole string).