Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native: Android vs iOS JSON parsing #28

Closed
bbil opened this issue Dec 29, 2016 · 1 comment
Closed

React Native: Android vs iOS JSON parsing #28

bbil opened this issue Dec 29, 2016 · 1 comment

Comments

@bbil
Copy link

bbil commented Dec 29, 2016

Started working on polishing the Android version of our React Native application, and I came across a strange issue that I'm not sure how to solve.

I was not able to login to the application once I got it building. So, I did some debugging with log statements and found that the session token and other information from the login api call was not being saved properly. Doing console.log(response.body) showed all the information I expected, but doing console.log(response.body.session_token) gave undefined. On a hunch, I tried passing the body into JSON.parse and found that I was able to get the session token and other data just fine.

Going back to iOS however throws an error on the JSON.parse line, because response.body is already an object and not a string.

Is there something going on here between the operating systems? Looking at the frisbee source shows that it should be calling JSON.parse on my behalf, so I am very confused at the discrepancy here. I'd rather not pepper the code with try catches to parse the response properly on both platforms.

@bbil
Copy link
Author

bbil commented Jan 5, 2017

@niftylettuce I've tried upgrading React Native like you suggested, and now Frisbee seems to be working correctly on Android.

@bbil bbil closed this as completed Jan 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant