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

274
Views
cómo resolver este error en React.js nativo " SyntaxError: JSON Parse error: Unexpected end of input "

Estoy trabajando en React-native. e intento llamar a una API pero me encuentro con un error en json

Mi error es [SyntaxError: JSON Parse error: final inesperado de la entrada]

mi codigo es por favor

 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
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!