Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinovon/NNJSON
JSON library for Java, compatible with CLDC 1.1 & JDK 1.1
https://github.com/shinovon/NNJSON
j2me json json-library
Last synced: 4 months ago
JSON representation
JSON library for Java, compatible with CLDC 1.1 & JDK 1.1
- Host: GitHub
- URL: https://github.com/shinovon/NNJSON
- Owner: shinovon
- License: mit
- Created: 2021-11-07T10:46:03.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-22T15:46:53.000Z (6 months ago)
- Last Synced: 2024-07-22T19:09:51.520Z (6 months ago)
- Topics: j2me, json, json-library
- Language: Java
- Homepage:
- Size: 55.7 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-j2me - NN JSON - JSON parser for CLDC 1.1. (Development)
README
# cc.nnproject.json
JSON library for Java, compatible with CLDC 1.1 & JDK 1.1## Usage example:
`JSON`:
```
JSONObject json = JSON.getObject(str);
System.out.println(json.getArray("messages").getObject(0).getNullableString("text"));
````JSONArray`, `JSONObject`:
```
JSONArray objects = new JSONArray();JSONObject object1 = new JSONObject();
object1.put("some", "Example text");
objects.add(object1);JSONObject object2 = new JSONObject();
object2.put("n", 292);
objects.add(object2);System.out.println(objects.build());
````JSONStream`:
```
JSONStream stream = JSONStream.getStream(connection.openInputStream());
try {
stream.expectNextTrim('{');
if(!stream.jumpToKey("response")) return;
stream.expectNextTrim('{');
if(!stream.jumpToKey("items")) return;
stream.expectNextTrim('[');
if(!stream.skipArrayElements(3)) return;
stream.expectNextTrim('{');
if(!stream.jumpToKey("date")) return;
System.out.println(stream.nextValue());
} finally {
stream.close();
}
```