# Ionic get array from json - web service

**URL:** <https://forum.ionicframework.com/t/ionic-get-array-from-json-web-service/185297>\
**Category:** Ionic Framework\
**Created:** [March 17, 2020, 2:22pm UTC](https://forum.ionicframework.com/t/ionic-get-array-from-json-web-service/185297 "2020-03-17T14:22:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![slhndr](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/slhndr/32/131176_2.png) [@slhndr](https://forum.ionicframework.com/u/slhndr)\
**Post date:** [March 17, 2020, 2:22pm UTC](https://forum.ionicframework.com/t/ionic-get-array-from-json-web-service/185297/1 "2020-03-17T14:22:48Z")

</div>

i’m using

```auto
 import { HTTP } from '@ionic-native/http/ngx';

```

for http requests from ionic app. But it doesn’t working for me.

This codes from ionic framework documentation:

```auto
import { HTTP } from '@ionic-native/http/ngx';

constructor(private http: HTTP) {}

this.http.get(myJsonApiUrl, {}, {})
  .then(data => {

    console.log(data.status);
    console.log(data.data); // data received by server
    console.log(data.headers);

  })
  .catch(error => {

    console.log(error.status);
    console.log(error.error); // error message as string
    console.log(error.headers);

  });

```

This code not displaying error detail. Only display : “undefined” for error.error

sorry for my english.

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [March 17, 2020, 8:41pm UTC](https://forum.ionicframework.com/t/ionic-get-array-from-json-web-service/185297/2 "2020-03-17T20:41:14Z")

</div>

> [@slhndr](#):
>
> i’m using
> 
> ```auto
> import { HTTP } from '@ionic-native/http/ngx';
> 
> ```
> 
> for http requests from ionic app.

Angular’s `HttpClient` is much more user-friendly. I would recommend using that instead. If you are going to respond with “I was doing that, and then I ran into CORS trouble”, then I’m going to say “CORS should really be fixed on the server side, not kludged around on the client side”.

---

<div class="post-metadata">

**Author:** ![EinfachHans](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/einfachhans/32/130917_2.png) [@EinfachHans](https://forum.ionicframework.com/u/EinfachHans)\
**Post date:** [March 18, 2020, 6:56am UTC](https://forum.ionicframework.com/t/ionic-get-array-from-json-web-service/185297/3 "2020-03-18T06:56:17Z")

</div>

What is the Result when you just log the `error`?
