# Error to get data from url json

**URL:** <https://discourse.processing.org/t/error-to-get-data-from-url-json/4335>\
**Category:** Coding Questions\
**Created:** [October 10, 2018, 4:26pm UTC](https://discourse.processing.org/t/error-to-get-data-from-url-json/4335 "2018-10-10T16:26:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Banjer71](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/banjer71/32/1913_2.png) [@Banjer71](https://discourse.processing.org/u/Banjer71)\
**Post date:** [October 10, 2018, 4:26pm UTC](https://discourse.processing.org/t/error-to-get-data-from-url-json/4335/1 "2018-10-10T16:26:14Z")

</div>

Hi

 ![error_load_json_from_url](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/62e43d348a18b09b7335f5ab6db3bc6229fe14ea.jpeg)  
I am having a problem to get the jason data from an url. I got this error from chrome dev tool. It seems that everything has to be processed via https and no http. There is a way to bypass it!

Thanks  
Banjer71

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [October 10, 2018, 9:36pm UTC](https://discourse.processing.org/t/error-to-get-data-from-url-json/4335/2 "2018-10-10T21:36:13Z")

</div>

> [@Banjer71](#):
>
> It seems that everything has to be processed via `https` and no `http`.

The `https://` protocol can’t load `http://` URIs AFAIK: 😞

> <https://gist.github.com/GoSubRoutine/7a567f0510b338b6d0fc1ef53f24f10e>
>
> There are more than three files. show original

> <https://github.com/open-notify/Open-Notify-API/issues/19>
>
> Currently the apis are served with http(without ssl).
> 
> http://api.open-notify.…org/iss-now.json
> As you know browser won't let access HTTP from HTTPS
> 
> Please add SSL to provide apis on HTTPS...

> <https://github.com/open-notify/Open-Notify-API/issues/9>
>
> Hey there. The Open Notify API is awesome, but it would be really nice if the se…rver could be updated to HTTPS.
> 
> When it comes to iOS development, you need to edit app settings and hack around stuff to be able to use this API because Apple made it default behavior for developers to not be able to make requests to "non secure" URLs.

---

<div class="post-metadata">

**Author:** ![Banjer71](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/banjer71/32/1913_2.png) [@Banjer71](https://discourse.processing.org/u/Banjer71)\
**Post date:** [October 11, 2018, 6:57am UTC](https://discourse.processing.org/t/error-to-get-data-from-url-json/4335/3 "2018-10-11T06:57:59Z")

</div>

This means that is there no way to fix this? Is it a [http://api.open-notify.org](http://api.open-notify.org) issue? Being a total beginner with this kind of things, there is a way to use some api that really works with some of the eamples Daniel Shiffman shows in his tutorials.  
I tried to replace that api with another ones Shiffman use in another tutorial and it is https but this time I get another kind of error : “Access-Control-Allow-Origin” . I am going crazy…

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [October 11, 2018, 7:10am UTC](https://discourse.processing.org/t/error-to-get-data-from-url-json/4335/4 "2018-10-11T07:10:19Z")

</div>

> [@Banjer71](#):
>
> This means that is there no way to fix this?

If you had checked my own Open-Notify sketch in my 1st reply:

> <https://gist.github.com/GoSubRoutine/7a567f0510b338b6d0fc1ef53f24f10e>
>
> There are more than three files. show original

You’d see it works as long the “.html” file is running under the `http://` protocol.

If your only option is to use the `https://` protocol, maybe you can find some proxy service which would access [http://api.Open-Notify.org/astros.json](http://api.Open-Notify.org/astros.json) and forward it back to your sketch.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [October 11, 2018, 7:15am UTC](https://discourse.processing.org/t/error-to-get-data-from-url-json/4335/5 "2018-10-11T07:15:41Z")

</div>

> [@Banjer71](#):
>
> … but this time I get another kind of error : “Access-Control-Allow-Origin”.

A site needs to explicitly allow access to its resources, so we can load them. That’s called CORS:

> **[Cross-Origin Resource Sharing (CORS) - HTTP | MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)**
>
> Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources. CORS also relies on a mechanism by...

If a site doesn’t enable CORS, we’re gonna need some proxy service in order to bypass it! 🙃

---

<div class="post-metadata">

**Author:** ![Banjer71](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/banjer71/32/1913_2.png) [@Banjer71](https://discourse.processing.org/u/Banjer71)\
**Post date:** [October 11, 2018, 8:28am UTC](https://discourse.processing.org/t/error-to-get-data-from-url-json/4335/6 "2018-10-11T08:28:21Z")

</div>

Wow let me say thank you first of all for your reply!!!  
I checked your post but as I said before I am a beginner and actually I did not understand that it was a solution 🙂 I am going to find out how to use it in my file. and thank you also for the mdn link!!
