Reformatting large JSON file via /r/learnprogramming

Reformatting large JSON file

Hey all,

I've just finished (legally) scraping a site for a bunch of TV show titles. It's my first time doing this, and I was able to organize the JSON output using Atom's pretty-json plugin, but the data isn't in a usable format yet.
The process:
* I scraped the site with a Scrapy spider, this is my spider code.
* My spider parsed the content and stored each title in a single, massive list – one list for each alphabetical page. Here's the output JSON file after being prettied up.
* I now need to use this JSON data in an autocomplete function, which I'm a bit confused about. I'm using the autocomplete input form from Materialize.CSS, which uses jQuery's autocomplete function.

So the last bullet point is where I'm stuck. How can I format this massive JSON file to be a key-value pair like this:
"title_of_book" : null,

The reason for this is that the data autocomplete takes looks like this:
data: {
"Adventure Inc." : null,
"…" : null,

Thanks in advance!

Submitted July 16, 2017 at 04:48PM by YelluhJelluh
via reddit


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s