4 ms·
How do you express "Why didn't you use <img src="xml_has_its_uses.png"> XML!?" with json?
by dpe82 7y ago
How do you express
"Why didn't you use <img src="xml_has_its_uses.png"> XML!?"
with json?
- rolltiide 7y agoyou don't, you just store the string as is in the body tag and let the client side parser know how to parse html strings that may also include an image tag what is the argument here? why didn't you know you answered your own question "body":"Why didn't you use <img src="xml_has_its_uses.png"> XML!?"
- grenoire 7y agoOP is asking what the content type of the body is to be interpreted as. You're assuming HTML string, which might not always be correct. What do you do with Markdown? You need to have a standard way to represent things like this, because otherwise it won't gain traction solely due to the immense complexity of implementing viewers. Edit: On top of this, HTML might not necessarily be the best choice. In that case it'd just be browser wrappers galore.
- elcomet 7y agoWell grandparent also assumed HTML since he put an HTML tag with html attributes in his node. I'm not sure how different this is, and if he wants to convert this to markdown he'll also need a html to markdown converter.
- rolltiide 7y agogain traction? you are really talking about a non-issue this decade everyone is already used to making their frontend, backend and database parse and store external things in key value pairs this schema pre-detecting ship has sailed a long time ago
- jazzyjackson 7y agoAssuming It's eventually going to be read as HTML I do this {"body":{ "childNodes": [ {"span":{"textContent":"Why didn't you use "}}, {"img":{"src":"xml_has_its_uses.png"}}, {"span":{"textContent":" XML!?"}} ] }}