Comments (3)
Hi @mastermind1981!
What do you mean by complex type? Java Beans with getter and setter methods? If so, it is not possible to dynamically modify its content (can only be used for generating JSONs with Jackson API). The Tree API designed for working with Collections.
Tree API doesn't use reflection for speed and simplicity, only works with collection classes (Map, List, Array) and generic data types. These generic types are: numbers (int, float, short, double, BigDecimal, BigInteger, byte, long), String, Date, InetAddress, UUID, Boolean and byte array.
If you want to put Java Beans into a Tree, convert them into a simple, hierarchical collection-based structure. For this purpose (to convert POJO to Map), use the ObjectMapper class. The Map created with the ObjectMapper can be wrapped with a Tree object:
ObjectMapper objectMapper = new com.fasterxml.jackson.databind.ObjectMapper();
Map<String, Object> map = objectMapper.convertValue(pojo, Map.class);
Tree tree = new Tree(map);
tree.put("kycScoreResponse._return.resultDatas[0].actions.type", "value");
from datatree.
@berkesa thanks ... In fact, I was abusing the API a little ... my goal was to generate a properties file by constructing a Tree representing a class hierarchy with default values for the fields and storing the constructed Tree as Properties ... it worked except in the scenario described in my message
from datatree.
Ok, I understand. With the method above you can save POJO objects in the following formats:
- JSON (human-readable)
- YAML (human-readable)
- TOML (human-readable)
- SMILE (binary)
- BSON (binary)
- CBOR (binary)
from datatree.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datatree.