Hi All,
Sample JSON data: {"name": "dev","salary": 100,"occupation": "engg","address": "noida"} {"name": "karthik","salary": 200,"occupation": "engg","address": "blore"} Spark Java code: DataFrame df = sqlContext.read().json(jsonPath); df.printSchema(); df.show(false); Output: root |-- address: string (nullable = true) |-- name: string (nullable = true) |-- occupation: string (nullable = true) |-- salary: long (nullable = true) +-------+-------+----------+------+ |address|name |occupation|salary| +-------+-------+----------+------+ |noida |dev |engg |10000 | |blore |karthik|engg |20000 | +-------+-------+----------+------+ Columns are arranged in the alphabetical order. Is there any way to maintain natural order? Regards, Devender ________________________________ NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.