# mini-json **Repository Path**: maoanping/mini-json ## Basic Information - **Project Name**: mini-json - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-03-16 - **Last Updated**: 2024-03-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # mini-json one compact json writer and reader base on standard JavaSE compact 1 level, it is performance optimized for Java IoT. There are some famous JSON API, such as Gson, fast json, alibaba json and etc. Some of them are good at processing long json data, some of them are emphasized in data integrity. This mini json library is intended for embed device with edge computing equipped with JVM. It is aim to straightforward, smallfoot print. #Core concepts - JsonElement: top level json object representation - JsonUncertain: inherit from JsonElement, it means the parsed original json data field but type is not determined - JsonNull: null representation - JsonObject and JsonArray: object and array type representation - JsonSystem: core json system, it owns all JsonDeserializer and JsonSerializer for java types - JsonDeserializer: defined method of deserialize json string to java instance - JsonSerializer: defined method of serialize java instance to json string - JsonWorker: combination of JsonDeserializer and JsonSerializer - JDKReflectJsonWorker: built-in java reflect based serializer and deserializer #Demo codes ```java //read json string JsonElement result = new JsonReader.parse(json); //the cast to JsonObject or JsonArray //or you can access attributes directly because its transparent composite //design pattern //suppose it is json array result.getAsStringAt(0) //suppose it is json object result.getAsString("memberName");// ``` ```java //write json string String jsonString=new JsonWriter().stringify(bean); ``` ```java //override type's JsonSerializer and JsonDeserializer //override in global scope JsonSystem.globalJsonSerializer(); JsonSystem.globalJsonDeserializer(); //override in instance level JsonReader r=new JsonReader(); r.registerJsonDeserializer(your impl); JsonWriter w=new JsonWriter(); w.registerJsonDeserializer(your impl); ... ```