Hi,

I have the following HTML:

<ul>
    <li>
        <div>Something</div>
        <ul>
            <li>
                <div>Something</div>
                <ul>
                    <li>
                        <div>Something</div>
                        //more lists can come
                    </li>
                    <li>
                        <div>Something</div>
                    </li>
                </ul>
            </li>
            <li>
                <div>Something</div>
            </li>
        </ul>
    </li>
    <li>
        <div>Something</div>
    </li>
</ul>

The list can continue endlessly and the count of sublist is unknown (user defined). Is there a way to convert this into a JSON format string?

Thanks

There isn't! (At least not theoretically).
Practically? There is!
- But the method chosen for conversion will have to be idiomatic. Therefore not understood by anybody else unless canonized and learned by other parties of same interest.

Member Avatar for stbuchok

How do you get the list there in the first place? Is it just hard coded? Are you building it from an ajax call?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.