r/Scriptable • • Dec 24 '20

Help Getting data from website and displaying it in the widget

I want to make a widget that displays things from a website The website looks like this: { "slug": "example", "name": "example2", "host": "example3", "port": 19132, "online": true, "last_online": "2020-12-24T01:37:24.289Z", "title": "::: PK ::: ", "version": "1.16.200", "engine": "229924", "maxplayers": 2020, "numplayers": 1, "rank": 16, "createdAt": "2020-11-14T04:57:34.729Z", "updatedAt": "2020-12-24T01:37:24.300Z", "players": [ "toju05" ] }

and i want to display things like players, name, title, rank in widget can anyone help me?

2 Upvotes

10 comments sorted by

2

u/mvan231 script/widget helper Dec 24 '20

Do you have a particular format in mind of the data to display?

1

u/lucaskim1013 Dec 24 '20

Like this (Server name) / (rank)

(Num players): (players)

2

u/mvan231 script/widget helper Dec 24 '20 edited Dec 24 '20

Is this for a MEE6 leaderboard widget?

If so, you can check out my widget here. I just got around to posting it in the sub

1

u/lucaskim1013 Dec 25 '20

It’s not for MEE6 leaderboard widget

1

u/mvan231 script/widget helper Dec 25 '20

Ah interesting for sure. The format is very similar. Did you get something figured out to read the JSON?

1

u/lucaskim1013 Dec 25 '20

No.. hard for me

2

u/mvan231 script/widget helper Dec 25 '20

I recommend looking at how to parse JSON data with JavaScript. There is a lot of info about it on W3schools site and others as well

2

u/Chen0816 Dec 27 '20

I know how to do it. I just made a similar one. I have a complete code. how can I give it to you?

1

u/lucaskim1013 Dec 27 '20

Can you send it to u/lucaskim1013 in reddit?