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

261
Vistas
Object, object Problem | Using country - city json file compatible with PrimeReact

I am trying to embed country - city json file with PrimeReact. I am having difficulty because of this. I'm pulling the information for the country, but the city shows as [Object, object ].

 <AutoComplete
              placeholder="Search Country"
              dropdown
              value={selectedCountryValue}
              id="dd"
              completeMethod={searchCountry}
              onChange={(e) => setSelectedCountryValue(e.value)}
              suggestions={autoFilteredValue}
              field="name"
              style={{ marginLeft: 10, height: 40, width: 267 }}
            />
 <AutoComplete
              placeholder="Search City"
              dropdown
              value={selectedCountryValue}
              id="dd"
              completeMethod={searchCity(selectedCountryValue)}
              onChange={(e) => setSelectedCountryValue(e.value)}
              suggestions={selectedAutoValueCity}
              field="states"
              style={{ marginLeft: 10, height: 40, width: 267 }}
            />

I used variables. When I select the country, the json other data comes. Console.log also works flawlessly

const searchCity = (event) => {
    setTimeout(() => {
      if (event) {
        console.log("here");
        console.log(event.states.map((obj) => obj.name));
        return event.states.map((obj) => obj.name);
      }
    }, 250);
  };

The Json data sequence is also as shown below.


"data" :[
    {
      "code2": "AF",
      "code3": "AFG",
      "name": "Afghanistan",
      "capital": "Kabul",
      "region": "Asia",
      "subregion": "Southern Asia",
      "states": [
        {
          "code": "BDS",
          "name": "Badakhshān",
          "subdivision": null
        },

about 4 years ago · Juan Pablo Isaza
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