Skip to content

Instantly share code, notes, and snippets.

@deanacus
Created November 3, 2019 09:52
Show Gist options
  • Save deanacus/ee4738c3194bef95d7c99613c852bb8b to your computer and use it in GitHub Desktop.
Save deanacus/ee4738c3194bef95d7c99613c852bb8b to your computer and use it in GitHub Desktop.
Rough outline of the way I'd structure simple textual content from html to JSON
{
"article": {
"meta": {
"title": "Test Post",
"date": ""
},
"content": [
{
"element": "h1",
"content": ["This is a heading"],
"hasNested": false
},
{
"element": "p",
"content": ["Lorem ipsum dolor sit amet consectetur adipisicing elit. Vero ipsa, non quibusdam debitis perferendis libero corporis eaque fugit quis ipsum delectus."],
"hasNested": false
},
{
"element": "p",
"content": [
"Lorem ipsum dolor sit amet",
{
"element": "link",
"content": "consectetur adipisicing",
"href": "https://google.com",
"hasNested": false
},
" elit. Vero ipsa, non quibusdam debitis perferendis libero corporis eaque fugit quis ipsum delectus."
],
"hasNested": true
},
{
"element": "ol",
"content": [
{
"element": "li",
"content": [
"List Item 1"
],
"hasNested": false
},
{
"element": "li",
"content": [
"List Item 2 ",
{
"element": "em",
"content": [
"with emphasis"
],
"hasNested": false
}
],
"hasNested": true
}
],
"hasNested": true
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment