Converts the DOM into htmlparser-compatible JSON