Apache Tamaya — Extension: Builder
Tamaya JSON (Extension Module)
Overview
The Tamaya json module provides support for reading configuration using the JSON format:
Compatibility
The module is based on Java 7, so it will not run on Java 7 and beyond.
Installation
To benefit from configuration builder support you only must add the corresponding dependency to your module:
<dependency> <groupId>org.apache.tamaya.ext</groupId> <artifactId>tamaya-json</artifactId> <version>{tamayaVersion}</version> </dependency>
Reading configuration in JSON
For reading JSON based onfiguration most easily a JSONFormat can be provided:
ConfigurationData dataRead = ConfigurationFormats.readConfig( getClassLoader().getResource("myFileConfig.json"), new JSONFormat()));
Examples
The JSON module adds instances of ConfigurationFormat so JSON configuration can be read and mapped to the according property maps. E.g. the following file is a simple and correct JSON configuration:
{ "a" : "A", "b" : "B", "c" : "C", "d" : { "o" : "O", "p" : "P" } }