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

296
Vistas
how to solve this error on react native " SyntaxError: JSON Parse error: Unexpected end of input "

i am working on React-native. and trying to calling a api but i am facing error in json

My error is [SyntaxError: JSON Parse error: Unexpected end of input]

my code is , please

 fetch('https://example.com/api/xyz_api.php', {
      method: 'POST',
      mode: 'no-cors',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        'mail_id': this.state.email_id,
        'pass':this.state.pass,
        'API_KEY':'API9723887855',
      })
    }).then((response) => response.json())
    .then((json) => {
      //this._storeData(json.flag);
      console.log(json);
      //this.setState({data:json});
      if(json.flag == '1')
      {
        _storeData();  
        this.props.navigation.navigate('MainScreen');

      }
      else if(json.flag == '2')
      {
        this.setState({error:'User not exist'});
        this._showDialog();
      }
      else if(json.flag == '3')
      {
        this.setState({error:'Incorrect Pasword'});
        this._showDialog();
      }

    }).catch((err) => { console.log(err); });
almost 4 years ago · Santiago Trujillo
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