How to parse nested JSON using Scala Spark ?

Handing nested JSON could be a very frustrating task. If you do not know the concepts. we often face many challenges while dealing with nested JSON structure .Here I will try to explain all concepts in few steps.

For example -

“student_name”:”Ram kumar”,
“DOB” : “10–02–1995”
“contact_number”:{“primary”:963343944,”secondary”:883673363 }