Skip to content

Advanced Meatloaf Operations

datarunners edited this page Jan 16, 2024 · 2 revisions

That's right, Meatloaf supports JSON interactions. You can easily build programs to parse JSON responses. Checkout this sample in Commodore BASIC:

10 rem *** open comms
11 open 15,16,15, ""
12 open 2,16,2,"https://whatsmyip.dev/api/ip"

20 rem *** receive and parse data
21 print#15, "jsonparse,2"
22 print#15, "jq,2,/addr"
23 input#2,ip$

30 rem *** close and print data
31 close 2: close 15
32 print "my ip:",ip$

By utilizng device 16, you can make requests to external APIs and process the returning data. The above opens a connection the api hosted at WhatsMyIP.dev and returns the 'addr' field to the program. It's then printed to the screen in line 32. It's just that simple!

Clone this wiki locally