Nepeo Thanks for your solution, it seems a rare way to implement it. Anyway it's solved now.
Well it's similar to how push would be implemented at a programming language level. It would be nice to support more types in the push action, but as the expression system only supports strings and numbers that becomes much harder.
When designing the JSON plugin we did have a prototype that separated the creation of values from inserting them. While this worked and allowed performing push/pop with complex types it was confusing to use and was awkward to implement so it was ultimately scrapped in favour of a simpler system.
With the current system we could plausibly implement additional actions for pushing other types ( PushObject, PushArray, PushBoolean, PushNull, PushJSON ), I'll review how feasible that is.
Nepeo Is there a way to make it persistent? I notice it does reset since is not saving new objects when I go to different layout.
The instances of the JSON plugin are not modified or deleted when the layout is changed, so it is already persistent. I checked with the debugger and you can see the instances persisting between layout changes, perhaps you are referencing the wrong instance of the plugin?