Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

170
Vistas
getting information from a javascript json object

I imagine this has been posted before but I wasn't able to find a data object specifically like this one. I'm struggling to understand how extract information from this data object in javascript. It's a parsed URL.

 data =  URL {
  href: 'http://localhost:8080/test.txt?cat=Mouse',
  origin: 'http://localhost:8080',
  protocol: 'http:',
  username: '',
  password: '',
  host: 'localhost:8080',
  hostname: 'localhost',
  port: '8080',
  pathname: '/test.txt',
  search: '?cat=Mouse',
  searchParams: URLSearchParams { 'cat' => 'Mouse' },
  hash: ''
}

I can retrieve the URLsearchParams data.searchParams, which returns { 'cat' => 'Mouse' }

What is this data structure called: { 'cat' => 'Mouse' }. I'm confused by the => And how do I retrieve the two objects 'cat' and 'Mouse' separately inside this data structure?

For example, retrieving then setting a variable equal to the first item, 'cat' and another variable equal to 'Mouse'

Thank you

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

What is this data structure called: { 'cat' => 'Mouse' }.

That isn't a data structure. It's a visual representation of the data in the URLSearchParams object.

Look at the API documentation to see how to access it (e.g. data.searchParams.entries())


There is absolutely nothing JSON related to that.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda