[英]Get JSON object in Clojure
I have such code: 我有这样的代码:
(defn my-journey-page [locale]
(render-string
(read-template "myJourney") {:api (:api props)
:feedback (:feedback props)}))
...
(def props (get-props))
...
(def default-props {:api "https://dev"
:feedback (json/write-str {:feedback {:en "en" :fi "fi" :sv "sv"}
:survey {:en "en" :fi "fi" :sv "sv"}})})
And I need to help with putting a valid JSON object to feedback key. 我需要帮助将有效的JSON对象放入反馈键。 I use clostache as a template.
我使用clostache作为模板。 In current case it returns:
在当前情况下,它返回:
var obj = {
feedback: '{"feedback":{"en":"en","fi":"fi","sv":"sv"},"survey":{"en":"en","fi":"fi","sv":"sv"}}'
}
How can I get it correctly? 如何正确获取?
For any mustache-based template system, the following should apply: 对于任何基于胡须的模板系统,应遵循以下条件:
You didn't show what your template looks like, but you should be able to get the value of your feedback
variable without HTML-escaping by writing {{{feedback}}}
(triple braces) instead of {{feedback}}
in the template. 您没有显示模板的外观,但是您应该能够通过以下方式编写
feedback
变量的值,而无需进行HTML换码,方法是在命令行中编写{{{feedback}}}
(三括号)而不是{{feedback}}
模板。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.