Created
November 3, 2019 09:52
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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