How do you display a field with an embedded quote mark in JSON-LD?

强颜欢笑 提交于 2019-12-11 07:35:02

问题


JSON-LD fields are supposed to be double quoted

"name":  "value", 

but what if the value has an embedded double quote, like

"name" : "Magnetic Strip (36" Length)"

Is it sufficient to escape the double quote

"name" : "Magnetic Strip (36\" Length)"

or is there a better way?


回答1:


Yes, backslashes have to be used for escaping double quotes in string values:

A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes (if necessary).

(Number, boolean and null values don’t get enclosed in double quotes, but can’t contain double quotes in the value anyway.)



来源:https://stackoverflow.com/questions/56227069/how-do-you-display-a-field-with-an-embedded-quote-mark-in-json-ld

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!