Json

Built-in converter

Daobab contains its own Json converter because of two reasons:

1. The way how Daobab collects data in its structures can be problematic for popular Json converters. Daobab users would need to parse Daobab DTO to regular DTO objects or records, which may increase the development effort and slow down the overall performance.


2. The internal structure of Daobab brings quick access to data and keeps information about the date type.
Since this is a significant problem for regular json libraries, it was possible to build an internal converter, which for Daobab structures would be even more efficient than others.

Every Daoabab structure like Entities or Plates has a possibility to serialize their content to json through toJson() method:


        String json = film.toJson()


Exposing Daobab json via rest endpoints (Spring example):


        @GetMapping(value = "/getActorById/{id}")
        String getActorById(@PathVariable("id") Integer id) {
              return service.getActorById(id).toJson();
        }



© Copyright 2018-2023 Elephant Software Klaudiusz Wojtkowiak 
e-mail: contact@daobab.io