Java implementation of JSON.
A beginner project that I am proud of, because I worked hard on it.
I aim to enhance it further & further إن شاء الله, but when I finish this year, my last year in school :')
- Read JSON strings & files.
- Generate JSON strings & write them into files.
- Convert JSON objects to Java objects & vice versa.
- Access JSON fields using JSON pointers.
- supports nested JSON objects & arrays.
JSONObject obj = new JSONObject();
obj.put("$id", "User-info");
obj.put("name", "Gelobt");
obj.put("age", 16);
obj.put("isAlive", true);
JSONArray arr = new JSONArray();
arr.add("Java");
arr.add("C++");
arr.add("Cats");
obj.put("THINGS I LOVE", arr);
obj.write(new File("User-info.json"));
The file should look like this:
{
"isAlive":true
,"name":"Gelobt"
,"THINGS I LOVE": [
"Java"
,"C++"
,"Cats"
]
,"age":16
,"$id":"User-info"
}