I would receive JSON in various formats and hierarchies, Need to know the possibility to be able to convert any JSON format into CSV by forming columns dynamically.As an example,i have provided the required details,below is an multi level JSON and the expected CSV output
JSON
{
"getUsers":[
{
"UserInformation":{
"Id":1111122,
"firstName":"*****1",
"UserType":{
"name":"CP"
},
"primaryState":"MA",
"otherState":[
"MA",
"BA"
],
"createdAt":null
}
},
{
"UserInformation":{
"Id":3333,
"firstName":"*****3",
"UserType":{
"name":"CPP"
},
"primaryState":"MPA",
"otherState":[
"KL",
"TN"
],
"createdAt":null
}
}
]
}

A workable code like this:
Read json string and write CSV file
Serialization Classes
Edit
Dynamic parsing all format only with JSON reader is impossible. You need some tricky steps to parse it.