reading json without using relative path in django

Solutions on MaxInterview for reading json without using relative path in django by the best coders in the world

showing results for - "reading json without using relative path in django"
Niklas
14 May 2018
1"""
2So let's say you want to import a JSON file that you have in your
3local (Django Project) you can use this rather than using a relative
4path which can give you some issues.
5"""
6
7import importlib
8
9json_text = importlib.resources.read_text('app.folder_name', 'file_name.json')