-1

i have a large json text consisting of at least 2500 lines that contains MCQs, like this:

[[
"Cellular respiration is defined as:",
" An intracellular, energy-producing process",
" An extracellular, energy-producing process",
" An intracellular, energy-requiring process",
" An extracellular, energy-requiring process",
],[
"The physiological term for eating and drinking is:",
"Ingestion.",
"Propulsion.",
"Absorption.",
"Digestion.",
],[
"Nerve impulses:",
"Can travel either way along a neurone.",
"Travel more quickly in unmyelinated neurones.",
"Travel by saltatory conduction in myelinated neurones.",
"Travel during the refractory period.",
],[
"Which of the following is referred to as internal environment?",
"Intracellular fluid",
"Plasma",
"Cytosol",
"Extracellular fluid",
],[
"The two tiny openings in the laryngopharynx communicate with:",
"The oropharynx.",
"The maxillary sinus.",
"The middle ear.",
"The ethmoid sinus.",
],[
"Pontine area works opposite to:",
"Medullary area",
"Cortex",
"Red nucleus",
"Vestibular area",
],[
"In nerve cells:",
"The cell membrane is polarised in the resting state.",
"Sodium (Na+) is the principal intracellular cation.",
"At rest, Na+ tends to diffuse out of the cells.",
"Depolarisation occurs when Na+ floods out of the cells."]]

i want to store this text into a string variable and then convert it into json object. i have tried to do so like :

val jsonString = "......large-text....." ​

but the moment i paste that text in "jsonString" it jams the whole android studio , how can i store that text in a variable??

ADM
  • 20,406
  • 11
  • 52
  • 83
Asfir Ali
  • 11
  • 3
  • A better way to do it Just create a `.json` file under assets folder and read it when you need it [here it is](https://stackoverflow.com/questions/19945411/how-can-i-parse-a-local-json-file-from-assets-folder-into-a-listview). – ADM Jan 06 '22 at 07:47

1 Answers1

0

If you dont need to edit this long text, you can store as an asset .txt file. See more in https://developer.android.com/reference/android/content/res/AssetManager

ruby6221
  • 228
  • 1
  • 7