Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda