Hi,
One option to use if you can is to force df to use the schema order you prefer
like this.
DataFrame df =
sqlContext.read().json(jsonPath).select("name","salary","occupation","address")
-Hemanth
From: Devender Yadav <[email protected]>
Date: Monday, 24 April 2017 at 15.45
To: "[email protected]" <[email protected]>
Subject: How to maintain order of key-value in DataFrame same as JSON?
{"name": "dev","salary": 100,"occupation": "engg","address": "noida"}
{"name": "karthik","salary": 200,"occupation": "engg","address": "blore"}