hope you can help me solve a little problem.
i saw this post but still got some errors : How to convert HTML to JSON using PHP?
I created a PHP file which fetches a post from wordpress with this format
<h1><img src="category1.jpg" />Category 1</h1>
<ul>
<li>some text.<strong><em>AUTHOR 1</em></strong></li>
<li>some other text.<strong><em>AUTHOR 2</em></strong></li>
<li>some othe other text.<strong><em>AUTHOR 3</em></strong></li>
</ul>
<h1><img src="category2.jpg" />Category 2</h1>
<ul>
<li>some new text.<strong><em>AUTHOR 4</em></strong></li>
<li>some other new text.<strong><em>AUTHOR 5</em></strong></li>
<li>some othe other new text.<strong><em>AUTHOR 6</em></strong></li>
</ul>
what I am trying to achieve is json object looks like this:
[
{
category: "Category 1", content: [
{text: "some text.", author:"AUTHOR 1"},
{text: "some other text.", author:"AUTHOR 2"},
{text: "some other other text.", author:"AUTHOR 3"},
]
},
{
category: "Category 2", content: [
{text: "some new text.", author:"AUTHOR 4"},
{text: "some other new text.", author:"AUTHOR 5"},
{text: "some other other new text.", author:"AUTHOR 6"},
]
}
i need to use it for Angular modules afterwards.
is there any solution for this? any function?
many thanks!