module ViewModel::Controller

def wrap_json_view(view)

Traverse a tree and wrap all String terminals in CompiledJson
def wrap_json_view(view)
  case view
  when Array
    view.map { |v| wrap_json_view(v) }
  when Hash
    view.transform_values { |v| wrap_json_view(v) }
  when String, Symbol
    CompiledJson.new(view)
  else
    view
  end
end