Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

131
Views
Cómo crear una lista a partir de una matriz json

Lo que debo hacer es console.log todas las direcciones IP y los objetos dentro de los servicios y no tengo idea de qué hacer, mi código actual es

 fetch('https://search.censys.io/api/v2/hosts/search?q=' + option1 + '&per_page=' + option2 + '&virtual_hosts=' + option3, fetchauth) .then(response => response.json()) .then(response => console.log(response.result.hits[0].ip)) .catch(err => console.error(err));

ejemplo de respuesta de la API

https://pastebin.com/s7k2YLG5

Estoy planeando mostrar esta información dentro de una inserción de discordia.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puede usar Array.map() para obtener una lista de direcciones IP:

 response.result.hits.map(item => item.ip) 

 const response = { "code": 200, "status": "OK", "result": { "query": "query", "total": 34, "duration": 1245, "hits": [ { "ip": "xxxx", "services": [ { "port": 21, "service_name": "FTP", "transport_protocol": "TCP" }, { "port": 22, "service_name": "SSH", "transport_protocol": "TCP" }, ] }, { "ip": "yyyy", "services": [ { "port": 80, "service_name": "HTTP", "transport_protocol": "TCP" }, { "port": 443, "service_name": "HTTP", "certificate": "c3ea28c3a4eaa4075c45bb3740dd4207af099727eb654b974bb0b2a5703406b2", "transport_protocol": "TCP" } ], "location": { "continent": "Europe", "country": "France", "country_code": "FR", "timezone": "Europe/Paris", "coordinates": { "latitude": 48.8582, "longitude": 2.3387 }, "registered_country": "France", "registered_country_code": "FR" }, "autonomous_system": { "asn": 16276, "description": "OVH", "bgp_prefix": "51.38.0.0/16", "name": "OVH", "country_code": "FR" }, "last_updated_at": "2022-07-29T12:59:03.142Z" } ] } }; console.log(response.result.hits.map(a=>a.ip));

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!