I am trying to make a website for users to type information about themselves and eventually generate a Json file for them to download. I was able to create this using Java but I need some help turning this into a website for users to use.
Also, if there is any way I can do this using just JS, HTML and CSS.
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
import org.json.simple.*;
public class JsonFile {
@SuppressWarnings("unchecked")
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner scan = new Scanner(System.in);
System.out.println("Enter ID: ");
int id_Input = scan.nextInt();
System.out.println("Enter First Name: ");
String firstname_Input = scan.next();
System.out.println("Enter Last Name: ");
String lastname_Input = scan.next();
JSONObject patient = new JSONObject();
patient.put("id", id_Input);
patient.put("firstName", firstname_Input);
patient.put("lastName", lastname_Input);
System.out.println("Enter Father's First Name: ");
String firstname_father = scan.next();
System.out.println("Enter Father's Last Name: ");
String lastname_father = scan.next();
JSONObject father = new JSONObject();
father.put("firstName", firstname_father);
father.put("lastName", lastname_father);
JSONArray list = new JSONArray();
list.add(patient);
list.add(father);
try(FileWriter file = new FileWriter("testJSON.json")) {
file.write(list.toString());
file.flush();
}
catch(IOException e) {
e.printStackTrace();
}
}
}