Get a table from a website in json format

Get a table from a website in json format

Hello, I am completely new to javascript/jquery, so I have this simple question:
How would you best approach extracting a table from, say, a wikipedia article? I did it manually through my browser's console by selecting the wanted html table elements and looping through them, but I would like to automate this process (as in - have a script that takes the input link and saves the json output for the desired table on my disk). Is using the Wikipedia API the only way? I found it rather perplexing and complicated for the simple reason that I need it.