Re: Converting an unordered list into JSON
| From: | Stuart Dallas | Date: | Mon, 05 Mar 2012 17:07:10 +0000 |
| Subject: | Re: Converting an unordered list into JSON | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316893@lists.php.net to get a copy of this message | ||
On 5 Mar 2012, at 16:45, Jay Blanchard wrote:
> [snip]
> Difficult to answer without knowing how your data is currently stored. Gimme a var_dump or
> var_export of your data and I'll be able to give you an answer. -Stuart
> [/snip]
>
> It is an unordered nested list as in the following example -
>
> <ul>
> <li>foo</li>
> <li>bar
> <ul>
> <li>glorp</li>
> </ul>
> </li>
> </ul>
Ahh, the list is in an HTML document, suddenly it all becomes clear. DOMDocument is probably your
best bet here. Other HTML parsers are also available.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/