Is there a way to change a subvariable within a hash or a container in a FreeMarker template? For example, suppose I had:
{"name":"Bob", "city":"Detroit", "state":"OH"}
and I want to change the state to "MI". How would I go about doing that? I know about the assign tag, but the documentation says "Note that only top-level variables can be created/replaced". I am unsure as to whether this means subvariables can't be replaced with the assign tag, or subvariables can't be replaced by any means.
I figured out a simple way to do it:
<#assign hash = hash + {"state":"MI"}>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With