Change Subvariance in FreeMarker

Is there a way to change subvariance inside a hash or 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 can I do it? I know about tagging , but the documentation says: "Note that only top-level variables can be created or replaced." I am not sure what this means that sub-options cannot be replaced by a destination tag, or sub-options cannot be replaced by any means.

+3
source share
1 answer

I figured out an easy way to do this:

<#assign hash = hash + {"state":"MI"}>
+11
source

Source: https://habr.com/ru/post/1711946/


All Articles