I need help with an API .json file

Hacker News API

So I am trying to make a little app that has a little hacker news widget that shows the most popular article, newest, etc. But HN’s API is just a bunch of .json files. I have no experience with getting a .json file on the web nor parsing it. Any help? Here is the invitation to edit.

Thanks in advance,

The API URL simply returns some JSON.

JSON can easily be “converted”/parsed into a JavaScript object (JSON but not in string form) using JSON.parse(INPUTSTRING).

In order to retrieve the JSON from the URL you would need to send a request to it. I’d recommend using request.

Hope this helps.

1 Like

Was just checking out your post, and had a look at the hacker news api, ended up playing with it a little… you can see the project here HackerNews-dev Not sure if you are familiar with lit-html and using es6 modules but you can have a look at what I’ve done so far if any of it will help. Most things are happening in the src/template-base.js

Can help you out if your not too sure about anything.

Just found this project in the polymer group which looks pretty neat and may be able to get a few ideas from there…

1 Like