0
通过一个RESTful API返回的JSON响应包含某些键和其它键以这种方式(“document.title时”)方面的@符号。json2html如何处理特殊字符(例如@)在JSON键
我的一块JSON看起来像这样。
"fields": {
"document.content_type": [
"application/ms-word"
],
"document.name": [
"zh1.docx"
],
"@title": [
"The History of the Pencil"
],
"@date": [
"2016-01-13T07:30:25-0500"
],
"document.content": [
"some text goes here"
],
"@guid": [
"76c99131-23b1-4435-9b93-eaabd9e33a67"
]
}
在正常的JavaScript/jQuery的,我可以轻松地做场[ “@标题”] [0]拿到冠军或字段[ “document.content”]访问这些值[0]获取文档内容,但是这种格式在json2html转换中不起作用。
例如,这个代码在变换不起作用。
{"tag":"h4","html":"${fields['document.name'].0}"}
任何人都可以指出我如何在json/html转换中访问这些特殊的json标签。我知道在某些情况下,我可以将标签更改为更标准的格式,但如果我无法更改标签或由于某种原因需要保留这些标签,我该怎么办?
非常感谢!会这样。在响应中替换违规字符相当容易,似乎是解决方案。 –