commit | 514daa04456e3ff196696b03cc6db62eb7329ac3 | [log] [tgz] |
---|---|---|
author | Simulant87 <kult.nils@googlemail.com> | Sat Aug 31 05:48:40 2019 +0200 |
committer | Andrew Guibert <andy.guibert@gmail.com> | Fri Aug 30 22:48:40 2019 -0500 |
tree | dcf061b7050f58157adc14a8a63f5f24d031576d | |
parent | b86924e8a8089a9ec1009edbcc2145b0bb0a2ce9 [diff] |
316 improve exception message (#318) * improvement 316 add .idea directory to .gitignore .idea directory should not be checked and is auto generated by the IDE. So the directory should be ignored by git. Signed-off-by: Simulant <nfaupel.dev@gmail.com> * improvement 316 improve Exception message for missing constructor when the default constructor is missing, the class name is contained in the error message so the issue is easier to fix by the user. Added a unit test to ensure the class name is contained in the message. Signed-off-by: Simulant <nfaupel.dev@gmail.com> * improvement 316 add missing java doc for parameter Signed-off-by: Simulant <nfaupel.dev@gmail.com> * bugfix 316 assert JsonbException instead of RuntimeException Signed-off-by: Simulant <nfaupel.dev@gmail.com>
Yasson is a Java framework which provides a standard binding layer between Java classes and JSON documents. This is similar to what JAXB is doing in the XML world. Yasson is an official reference implementation of JSON Binding (JSR-367).
It defines a default mapping algorithm for converting existing Java classes to JSON suitable for the most cases:
Jsonb jsonb = JsonbBuilder.create(); String result = jsonb.toJson(someObject);
For whom it's not enough it provides rich customization abilities through a set of annotations and rich programmatic API:
// Create custom configuration JsonbConfig config = new JsonbConfig() .withNullValues(true) .withFormating(true); // Create Jsonb with custom configuration Jsonb jsonb = JsonbBuilder.create(config); // Use it! String result = jsonb.toJson(someObject);