# Property 'json' does not exist on type 'Object'

**URL:** <https://forum.ionicframework.com/t/property-json-does-not-exist-on-type-object/143411>\
**Category:** ionic-v3\
**Created:** [October 2, 2018, 6:16am UTC](https://forum.ionicframework.com/t/property-json-does-not-exist-on-type-object/143411 "2018-10-02T06:16:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nouf](https://avatars.discourse-cdn.com/v4/letter/n/bbe5ce/32.png) [@Nouf](https://forum.ionicframework.com/u/Nouf)\
**Post date:** [October 2, 2018, 6:16am UTC](https://forum.ionicframework.com/t/property-json-does-not-exist-on-type-object/143411/1 "2018-10-02T06:16:52Z")

</div>

it been a while since I last use Ionic and I am trying to do login, but I ma getting this error 'Property ‘json’ does not exist on type ‘Object’. under res.json

```auto
return new Promise((resolve, reject) => {
      let headers = new HttpHeaders();
      headers = headers.set('Authorization',');
      headers = headers.set('Content-Type','');
      this.http.post(apiUrl, JSON.stringify(body), {headers: headers})
        .subscribe(res => {
          resolve(res.json());
        }, (err) => {
          reject(err);
        });
  });

```

---

<div class="post-metadata">

**Author:** ![hariman](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/hariman/32/121974_2.png) [@hariman](https://forum.ionicframework.com/u/hariman)\
**Post date:** [October 2, 2018, 8:19am UTC](https://forum.ionicframework.com/t/property-json-does-not-exist-on-type-object/143411/2 "2018-10-02T08:19:57Z")

</div>

The call to json() is no longer needed here, the result is already parsed.

---

<div class="post-metadata">

**Author:** ![hupptechnologies](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/hupptechnologies/32/121997_2.png) [@hupptechnologies](https://forum.ionicframework.com/u/hupptechnologies)\
**Post date:** [October 2, 2018, 10:01am UTC](https://forum.ionicframework.com/t/property-json-does-not-exist-on-type-object/143411/3 "2018-10-02T10:01:47Z")

</div>

New httpClient by default calls `res.json()` implicitly and you don’t need to that manually yourself.

---

<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:** [October 2, 2018, 5:56pm UTC](https://forum.ionicframework.com/t/property-json-does-not-exist-on-type-object/143411/4 "2018-10-02T17:56:31Z")

</div>

While you’re fixing things, get rid of the pointless `Promise` and just do:

```auto
return this.http.post<WhateverTypeTheResultIs>(apiUrl, body);

```

There is no need for setting the content type explicitly, nor stringifying the body.

---

<div class="post-metadata">

**Author:** ![Nouf](https://avatars.discourse-cdn.com/v4/letter/n/bbe5ce/32.png) [@Nouf](https://forum.ionicframework.com/u/Nouf)\
**Post date:** [October 4, 2018, 5:32am UTC](https://forum.ionicframework.com/t/property-json-does-not-exist-on-type-object/143411/5 "2018-10-04T05:32:18Z")

</div>

but what if I want to covert to qs instead of JSON I still don’t have stringifying it?! + Is the place to find a tutorial or doc for all of this

---

<div class="post-metadata">

**Author:** ![Jacktoolsnet](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jacktoolsnet/32/107318_2.png) [@Jacktoolsnet](https://forum.ionicframework.com/u/Jacktoolsnet)\
**Post date:** [October 4, 2018, 6:09am UTC](https://forum.ionicframework.com/t/property-json-does-not-exist-on-type-object/143411/6 "2018-10-04T06:09:44Z")

</div>

Perhaps your server throws an error and send HTML or text as response back.

---

<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:** [October 4, 2018, 4:59pm UTC](https://forum.ionicframework.com/t/property-json-does-not-exist-on-type-object/143411/7 "2018-10-04T16:59:04Z")

</div>

Sorry, I have no clue what “qs” is, but [here](https://angular.io/tutorial/toh-pt6) is a tutorial on using `HttpClient`.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:13pm UTC](https://forum.ionicframework.com/t/property-json-does-not-exist-on-type-object/143411/8 "2021-07-19T21:13:56Z")

</div>


