How to read Local JSON file in ionic V4?

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to read Local JSON file in ionic V4?


this.http.get(‘assets/data/subtitles.json’).map(res => res.json()).subscribe(data =>
this.subtitles = data;
);



This is ionic v3 localJSON read code, I have used.



but ionic V3 type not supported to ionic V4





where did you import http from? Also are you getting any error logs in console?
– Suraj Rao
Aug 8 at 5:40


http




1 Answer
1



You can use fetch instead.




fetch('assets/data/subtitles.json').then(async res =>
this.subtitles = await res.json();
);






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

wehiCcEBwiG qG4
fFwZKJF90D6pDMpVGlV5iLIb7PTkZzZneUX,MsvwP3iVcSxPKg1 rzvCX8k8pL17,7,uohlVb8XvnM

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3