Note that there are some explanatory texts on larger screens.

plurals
  1. POJSON - reading nested data from a json file?
    primarykey
    data
    text
    <p>Here is my JSON data :</p> <pre><code>{ "main": [ { "main_id": "1234", "main_sub": [ { "main_info": { "main_1" : "A", "main_2" : "B", "main_3" : "C" }, "main_4" : "D", "main_5" : "E", }, { "main_6" : "F", "main_7" : "G", "main_info": { "main_1" : "H", "main_2" : "I", "main_3" : "J" }, "main_4" : "D", "main_5" : "E", "main_act": [ { "main_act_1": 12, "main_act_1_1": "C", "main_act_1_2": "T" }, { "main_act_1": 12, "main_act_1_1": "D", "main_act_1_2": "T" } ], "main_8" : "R" }, { "main_4" : "D", "main_5" : "E", "main_10": "P" } ], "main_score": 0.1 }, { "main_id": "1334", "main_sub": [ { "main_info": { "main_1" : "B", "main_2" : "Q", "main_3" : "C", "main_11": "D" }, "main_4" : "S", "main_5" : "E", "main_6" : "G", "main_7" : "T" }, { "main_6" : "F", "main_7" : "G", "main_info": { "main_1" : "A", "main_2" : "I", "main_3" : "J" }, "main_10": "W", "main_4" : "D", "main_5" : "E", "main_act": [ { "main_act_1": 112, "main_act_1_1": "C", "main_act_1_2": "T" }, { "main_act_1": 123, "main_act_1_1": "D", "main_act_1_2": "T" } ], "main_8" : "R" }, { "main_4" : "D", "main_5" : "E", "main_10": "P" } ], "main_score": 0.1 } ], "main_count": 2 } </code></pre> <p>I am not able to read a large part of this data due to the nesting even after I use $.each in jQuery.</p> <p>Also is there a way by which I could read every single line of this json data and print it on screen without actually mentioning the field names like "main_1" in my jQuery code ?</p> <p><strong>Output Expected :</strong></p> <p>I would just want to print the field names as well as well as their values for each of the two instances of main .</p> <p>Somewhat like :</p> <pre><code>main_id - 1234 main_sub - main_info - main_1 - A main_2 - B </code></pre> <p><strong>and so on..................</strong> (for both instances of main - thus the main_count = 2 at the end of the json data)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload