tags:

views:

137

answers:

1

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.

+1  A: 

I figured out a simple way to do it:

<#assign hash = hash + {"state":"MI"}>
mikez302
Accept this answer and close the thread
Arun P Johny
I accepted the answer. How can I close the thread? Why would I want to close the thread?
mikez302