Instagram/ig-json-parser là dự án mã nguồn mở trên GitHub với 1.3k sao, viết chủ yếu bằng Java. Fast JSON parser for java projects
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
If you are using other build systems, please find instructions here
Requirements for model classes
There should be a package-visible no-argument constructor for each of your
model classes. The fields also need to be package-visible.
Each class that needs a serializer/deserializer generated should be
annotated with @JsonType. Each field that needs to be mapped to/from
JSON should be annotated with @JsonField. The @JsonField annotation
has one mandatory argument, which is the fieldname for the field in the
JSON.
The following is an example of a very simple model class:
Compiling your model classes with the annotations will automatically
generate the serializer and deserializer. They will be in a generated
class with the same name as your class, except with the suffix
__JsonHelper. For example, to deserialize the Dessert class above,
simply run the code:
If you need to process your JSON after a first pass, you can change your @JsonType annotation to be @JsonType(postprocess = true) and add a method to your code and add a method YourClass postprocess() which will be called after the JSON is processed (see: QuestionableDesignChoice in the example below)
@JsonType
public class Example {
@JsonField(fieldName = "container")
Container mContainer;
@JsonType
public static class Container {
@JsonField(fieldName = "questionable_design_choice")
List<QuestionableDesignChoice> mQuestionableDesignChoice;
}
@JsonType(postprocessingEnabled = true)
public static class QuestionableDesignChoice {
@JsonField(fieldName = "property")
String mProperty;
QuestionableDesignChoice postprocess() {
// post-process things here...
return this;
}
}
}
Customized parsing code
Parsing the supported data types is straightforward. For enums or built-in Java classes, you will need to add customized parsing.
Value extract formatters override how we extract the value from the JsonParser object, while serialize code formatters override how we serialize a java field back to json. We use the serde for PointF in the example below, where a point is represented as an array in json.
To save generating serializer code if you only need deserialization, serializer generation can be disabled or enabled
globally and per-class. The default is to generate serializers for all classes. To disable generation globally, pass
-AgenerateSerializer=false
to the command-line arguments of javac. To override the default generation option for a single class, see
JsonType.generateSerializer().
Contributing
See the CONTRIBUTING file for how to help out.
License
ig-json-parser is MIT licensed, as found in the LICENSE file.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/Instagram/ig-json-parser là nguồn chính thức.
Instagram/ig-json-parser có bao nhiêu sao?
Instagram/ig-json-parser có 1.3k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/Instagram/ig-json-parser. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
Instagram/ig-json-parser có phải mã nguồn mở không?
Có — Instagram/ig-json-parser phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/Instagram/ig-json-parser.
Instagram/ig-json-parser có trang demo không?
Dự án có trang chủ ở https://instagram-engineering.com/fast-auto-generated-streaming-json-parsing-for-android-ab8e7be21033. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
Instagram/ig-json-parser là gì?
Instagram/ig-json-parser (Instagram/ig-json-parser) là dự án Java trên GitHub. Theo mô tả gốc: Fast JSON parser for java projects
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về ig-json-parser?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về ig-json-parser.