You can just use the correct JSON snippet and use it in an Import Mapping.
If some attributes are empty, that should be no problem.
In the JSON snippet you showed, you are missing the last line (with the closing brackets). This is the correct and valid JSON
[{
"Record ID": "0",
"Student details": [{
"Student Name": "Amrish Kumar",
"Student Age": "36",
"Student Class": "8th"
},
{
"Student Name": "Anil Kumar",
"Student Age": "38",
"Student Class": "12th",
"Student Subject": "English"
},
{
"Student Name": "Ajit Kumar",
"Student Class": "11th",
"Student Subject": "Hindi"
}
]
}]
Hi Amrish,
I had a similar problem. I hope it will be solution if you can use below two methods for dynamic json value.
I will present two methods. I used the first. I even used the answers from the forum for this but I can't remember which one at the moment.
1- Finding a solution by writing code in Java and keeping it as a Dictionary<key, value> pair: Not configuring the fields at all is not suitable for business logic. In this case, I assume you will want to display them on the screen. You can write a json map java action for this that creates a list of Mendix objects with 2 attributes like "key" and "value".
2- If there is a certain number of fields shown you can create a generic json snippet with all possible fields and Mendix will only map existing fields to an object. Or like the answers above, in case these fields are empty, you can check the default values and write them to the db.
I hope that helps in your project.
Regards