/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package javaapplication2; import java.io.IOException; import net.sf.json.JSONArray; import net.sf.json.JSONObject; /** * * @author zzaier */ public class JavaApplication2 { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { JSONObject employee= new JSONObject(); employee.accumulate("employeeid", "123456"); employee.accumulate("fname", "Zied"); employee.accumulate("lname", "Zaier"); employee.accumulate("sin", 123456789); employee.accumulate("retired",false); employee.accumulate("salary", 9999.99); JSONObject address= new JSONObject(); address.accumulate("streetnumber", 1001); address.accumulate("streetname", "Sherbrooke"); address.accumulate("postalcode", "H3S1S1"); employee.accumulate("address", address); JSONArray projects = new JSONArray(); JSONObject project = new JSONObject(); project.accumulate("name","mobile app project"); project.accumulate("nbrh",55); projects.add(project); project.clear(); project.accumulate("name","Backend project"); project.accumulate("nbrh",77); projects.add(project); project.clear(); project.accumulate("name","Database project"); project.accumulate("nbrh",100); projects.add(project); employee.accumulate("projects", projects); utilities.FileWriter.saveStringIntoFile("json/employee." + "json", employee.toString()); } }