Pandas read nested json
<p>I am curious how I can use pandas to read nested json of the following structure:</p>

<pre><code>{
    "number": "",
    "date": "01.10.2016",
    "name": "R 3932",
    "locations": [
        {
            "depTimeDiffMin": "0",
            "name": "Spital am Pyhrn Bahnhof",
            "arrTime": "",
            "depTime": "06:32",
            "platform": "2",
            "stationIdx": "0",
            "arrTimeDiffMin": "",
            "track": "R 3932"
        },
        {
            "depTimeDiffMin": "0",
            "name": "Windischgarsten Bahnhof",
            "arrTime": "06:37",
            "depTime": "06:40",
            "platform": "2",
            "stationIdx": "1",
            "arrTimeDiffMin": "1",
            "track": ""
        },
        {
            "depTimeDiffMin": "",
            "name": "Linz/Donau Hbf",
            "arrTime": "08:24",
            "depTime": "",
            "platform": "1A-B",
            "stationIdx": "22",
            "arrTimeDiffMin": "1",
            "track": ""
        }
    ]
}
</code></pre>

<p>This here keeps the array as json. I would rather prefer it to be expanded into columns.</p>

<pre><code>pd.read_json("/myJson.json", orient='records')
</code></pre>

<h1>edit</h1>

<p>Thanks for the first answers.
I should refine my question:
A flattening of the nested attributes in the array is not mandatory.
It would be ok to just [A, B, C] concatenate the df.locations['name'].</p>

<p>My file contains multiple JSON objects (1 per line) I would like to keep number, date, name, and locations column. However, I would need to join the locations.</p>

<pre><code>allLocations = ""
isFirst = True
for location in result.locations:
    if isFirst:
        isFirst = False
        allLocations = location['name']
    else:
        allLocations += "; " + location['name']
allLocations
</code></pre>

<p>My approach here does not seem to be efficient / pandas style.</p>