D
D
Doil77272018-08-01 11:04:13
Angular
Doil7727, 2018-08-01 11:04:13

How to parse Json?

[
  {
    "general": {
      "firstName": "Liana",
      "lastName": "Crooks",
      "avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/kevinoh/128.jpg"
    },
    "job": {
      "company": "Ledner, Johnson and Predovic",
      "title": "Investor Functionality Coordinator"
    },
    "contact": {
      "email": "[email protected]",
      "phone": "(895) 984-0132"
    },
    "address": {
      "street": "1520 Zemlak Cove",
      "city": "New Devon",
      "zipCode": "42586-7898",
      "country": "Guinea-Bissau"
    }
  },
  {
    "general": {
      "firstName": "Deontae",
      "lastName": "Dare",
      "avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/andysolomon/128.jpg"
    },
    "job": {
      "company": "D'Amore, Dicki and Borer",
      "title": "International Applications Consultant"
    },
    "contact": {
      "email": "[email protected]",
      "phone": "1-615-843-3426 x600"
    },
    "address": {
      "street": "65901 Glover Terrace",
      "city": "Alden ton",
      "zipCode": "57744-4248",
      "country": "Kenya"
    }
  }
]

I'm trying to parse like this:
getPeople() {
    return this.http.get('http://localhost:3000/global');
  }

in response I get this
Observable {_isScalar: false, source: Observable, operator: MapOperator}
operator
:
MapOperator {project: ƒ, thisArg: undefined}
source
:
Observable {_isScalar: false, source: Observable, operator: FilterOperator}
_isScalar
:
false
__proto__
:
Object Tell me
how to parse it correctly!
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Eremin, 2018-08-01
@EreminD

An Observable is returned to you - you need to subscribe (subscribe)
Like spend time - go through https://angular.io/tutorial - basic questions will disappear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question