-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for deserializing nested JSON documents (using google gson) #144
Conversation
Arrays containing JSON objects will not be parsed (to keep the code simple). For e.g. this is not valid – {
"server" : {
"admins": [
{"john": { "last_name": "doe"}},
{"ravi": { "last_name": "kumar"}},
]
}
} However this is legit – {
"server" : {
"admins": ["john", "ravi"]
}
} |
Hi, I've not seen any activity or interest in this PR (or commits to the repository). Anyone home? |
Hi everyone , I am having health problems so at the moment I am not Since some years I am affected by cancer and in these months I am following Cheers
|
77171b3
to
e244283
Compare
Hi — I'm sorry to hear that, and I hope you feel better. I just realized that I'd submitted the pull request against the main project, when a better place was the |
e244283
to
d84d467
Compare
For developers not wanting to use json, and to keep the dependency foot-print at a minimum, the gson dependency is set to "provided". The `LoadersManager` will check if Google's Gson parser is available on path before attempting to register the JSON parser. (I'm happy to change this behavior if you feel there's a better way to do this) Usage - ```json { "server": { "http": { "port": 80, "hostname": "localhost" }, "ssh": { "port": 22, "address": "127.0.0.1", "alive": { "interval": 60 }, "user": "admin" }, "admins": ["bob", "alice"] } } ``` ```java @Config.Sources({"classpath:org/aeonbits/owner/server.test.json"}) public static interface ServerConfig extends Config, Accessible { @key("server.http.port") int httpPort(); @key("server.http.hostname") String httpHostname(); @key("server.ssh.port") int sshPort(); @key("server.ssh.address") String sshAddress(); @key("server.ssh.alive.interval") int aliveInterval(); @key("server.ssh.user") String sshUser(); @key("server.admins") List<String> admins(); } ```
All well, the build failing is some container issue with travis ci (travis-ci/travis-ci#5227) |
Thanks!
|
The new year it should be better!
|
For developers not wanting to use json, and to keep the dependency foot-print
at a minimum, the gson dependency is set to "provided".
The
LoadersManager
will check if Google's Gson parser is available onpath before attempting to register the JSON parser. (I'm happy to change this
behavior if you feel there's a better way to do this)
Usage -