3 ms·
<p>How would you represent <b><i>mixed content</i></b> in JSON?</p>
by ssdspoimdsjvv 2y ago
<p>How would you represent <b><i>mixed content</i></b> in JSON?</p>
- winstonewert 2y ago`{ type: "p", children: [{type: "text", text: "How would you represent "}, {type: "b", children: [{type: "i", children: [{type: "text", text: "mixed content"}]], {type: "text", text: " in JSON?"]}` or: `{paragraphs: [{spans: [{ text: "How you represent "}, {bold: true, italic: true, text: "mixed content"},{text: " in JSON?"}]}`
- Finnucane 2y agoBut that's terrible! How is that better? And can you guarantee correct ordering?
- lioeters 2y ago["p", "How would you represent ", ["b", ["i", "mixed content"]], " in JSON?"]
- ssdspoimdsjvv 2y agoOh sure, it can be represented. But now JSON is the one being noisy, ugly and verbose.
- winstonewert 2y agoMy specific claim was that you could represent it in JSON, so you can't claim, as the post I responded to did, that JSON "cannot be used." I'll fully grant, I don't want to write a document by hand in either of the JSON formats I suggested. Although, given the choice, I'd rather receive it in that format to be parsed than in any XML format.