I'm new with Swift and am trying to get the JSON data from HTML I grabbed. I get the HTML from a website and there's one line in the whole result that has the data. Setup like: var obj = *JSON data*
How can I parse through the string results to only get that line and convert the data (right side of the equal sign) to JSON?
Here's my code to get the data (testURL is the url of the website):
if let url = testURL {
do {
let contents = try String(contentsOf: url)
print(contents)
} catch {
// contents could not be loaded
}
} else {
// the URL was bad!
}