I have a asset.json file with content, and need to read it within an react-native app. I already figured that it must be manually copied to the native implementation and I can v
Steps to read json file in react-native applications :-
1. Import it in your component
import ASSET_FILE from '../assets/files/asset.json';
// import filename from 'path to your asset file';
2. Now in a funtion
jsonParser(){
var data = JSON.parse(JSON.stringify(ASSET_FILE));
var tempProtobuf = []
var temptestImages= []
var tempparts= []
tempProtobuf = data.Protobuf
temptestImages = data.testImages
tempparts = data.parts
}
// Now three of your objects are there in tempProtobuf, temptestImages, tempparts array respectively.
Iterate if or save in state if you want to show in your application..
Hope this helps...Thanks :)