Java – Create dynamic forms from JSON in Android

Create dynamic forms from JSON in Android… here is a solution to the problem.

Create dynamic forms from JSON in Android

I’m new to Android development. I’m making an app like student registration, so I want to dynamically create forms from JSON files. And the table is in a View such as a wizard. I don’t know how to do this dynamically, please help me create it.

I have the following JSON file:

{
    "screen1": {
    "Basic Information" :[
        {
            "id": "3",
            "type": "birthdate",
            "ordering": "2",
            "name": "Birthdate",
            "tips": "Enter your date of birth so other users can know when to wish you happy birthday ",
            "options": "",
        },
        {
            "id": "4",
            "type": "textarea",
            "ordering": "3",
            "name": "About me",
            "tips": "Tell us more about yourself",
            "options": "",
        },
        {
            "id": "16",
            "type": "select",
            "ordering": "4",
            "name": "marital status",
            "tips": "single or married",
            "options": [
                "Married",
                "Unmarried",
                "Divorcee"
            ],

}
    ]
},

"screen3":
    {
     "Education" :[
        {
            "id": "14",
            "type": "text",
            "name": "College / University",
            "tips": "Your college or university name",
            "options": "",
        },
        {
            "id": "15",
            "type": "text",
            "ordering": "16",
            "name": "Graduation Year",
            "tips": "Graduation year",
            "options": "",
        }
    ]
}
}

Solution

Sorry for the long answer:
Try:

“screen1”: -> “\”screen1\” ” +”:”
like this, only change ” to ” \” “

Related Problems and Solutions