0

I have a noob question, I'm trying to read the movies.json of Facebook but from a sdcard.. i'm using RN-Fetch-Blob

RNFetchBlob.fs.readFile("file:///storage....", 'utf-8')
.then((data) => {
let id0 = data.movies[0].id;
})

but this is not working, how is the right way to read the id ?

1 Answers1

1

the type of data is string so you need to use JSON.parse(data)

RNFetchBlob.fs.readFile("file:///storage....", 'utf-8')
.then((data) => {
const newData = JSON.parse(data);
newData.movies[0].id;
})
ZoRky
  • 28
  • 1
  • 4