It's a question from Python Json

Asked 2 years ago, Updated 2 years ago, 37 views

// Enter code here
url = "https://8oi9s0nnth.apigw.ntruss.com/corona19-masks/v1/storesByAddr/json"

Hello, I'm a beginner studying Python I received json as url, but I want to bring up only certain values in the contents and display them on the screen, so I wonder what I should do.

python django

2022-09-20 22:13

1 Answers

There are two ways. It's a way to read the contents of the JSON on the server and make html to respond to it, and another way is to just draw it right away by AJAX GETING from a web browser to JS.

$.ajax({
  url: "https://8oi9s0nnth.apigw.ntruss.com/corona19-masks/v1/storesByAddr/json",
  dataType: "JSON",
  type: "GET"
}).done(function (data) {
  for (i = 0; i < data.stores.length; i++) {
    $('#masks').append('<p>' + data.stores[i].name + ' - ' + data.stores[i].addr + '</p>');
  }
});

Either way, try it.

PS. Usually, private APIs like this are not allowed to be used carelessly... Fortunately, this must be an open API. I didn't know that and I made you uncomfortable by posting weird comments. Sorry.


2022-09-20 22:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.