Skip to content

Repository files navigation

Java JSON

GradleJavadoc

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 :')

Features

  • 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.

Examples

Initialise a new JSON object

JSONObjectobj = newJSONObject();
obj.put("$id", "User-info");
obj.put("name", "Gelobt");
obj.put("age", 16);
obj.put("isAlive", true);

Initialise a new JSON array

JSONArrayarr = newJSONArray();
arr.add("Java");
arr.add("C++");
arr.add("Cats");

Put JSON array into JSON object

obj.put("THINGS I LOVE", arr);

Write JSON object into file

obj.write(newFile("User-info.json"));

The file should look like this:

{
"isAlive":true
,"name":"Gelobt"
,"THINGS I LOVE": [
"Java"
,"C++"
,"Cats"
]
,"age":16
,"$id":"User-info"
}

About

☕ Java implementation of JSON.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages