Instagram/ig-json-parser — 1.3k★ on GitHub (Java). Fast JSON parser for java projects
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
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.
How many stars does Instagram/ig-json-parser have?
Instagram/ig-json-parser has 1.3k GitHub stars — refresh the page for the live number, or check github.com/Instagram/ig-json-parser. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is Instagram/ig-json-parser open source?
Yes — Instagram/ig-json-parser ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/Instagram/ig-json-parser.
What is Instagram/ig-json-parser?
Instagram/ig-json-parser (Instagram/ig-json-parser) is a Java project on GitHub. From the project's own README: Fast JSON parser for java projects
Where can I see Instagram/ig-json-parser in action?
The project maintains a homepage at https://instagram-engineering.com/fast-auto-generated-streaming-json-parsing-for-android-ab8e7be21033. The README tab on this page also usually contains screenshots and a quickstart.
Where do I read more about Instagram/ig-json-parser?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/Instagram/ig-json-parser is the definitive source.
Read full README in the tab above.
Curious whether ig-json-parser is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about ig-json-parser.