tishka17 / gson-flatten Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU Lesser General Public License v3.0
License: GNU Lesser General Public License v3.0
Would it be possible to flatten objects in arrays? I am trying to parse the following data structure which has some unnecessary object nesting:
{
"content": {
"children": [
{
"section": {
"attrs": { ... },
"children": [ ... ]
},
...
}
]
}
I would like to get rid of the unnecessary section object and flatten it into a children object like so:
{
"content": {
"children": [
{
"attrs": { ... },
"children": [ ... ]
},
...
]
}
#1 наоборот:
Объект вида
class Weather {
@Flatten("temperature::min")
int min_temperture;
@Flatten("temperature::max")
int max_temperture;
}
должен конвертироваться в json
{
"temperature": {
"min": -273,
"max": 1000
}
}
Поддержка в Flatten формата вида @Flatten("obj::")
без указания последнего значения
Пример, такой json
{
"temperature": {
"min": -273,
"max": 1000
}
}
Должен конвертироваться в объект типа
class Weather {
@Flatten("temperature::")
int min;
@Flatten("temperature::")
int max;
}
Hi, I have a problem with using your library with mavenCentral(). I have to migrate from jcenter due to JCenter sunset.
Your library is only available on JCenter? Can you push it to mavenCentral?
Could not find org.itishka.gson-flatten:gson-flatten:0.8.1.
Разные типы:
Значения:
Поддерживать как аннотацию @SerializedName
, так и установленный в gson FieldNamingPolicy
.
Например, должен корректно работать код
class Weather {
@Flatten("temp::min")
int minTemp;
@Flatten("temp::max")
@SerializedName("qwerty")
int maxTemp
}
It seems you released 0.8 to include the merge of my pull request, but pulling version 0.8 using gradle still ends up with the old code =/
Пример, такой json
{
"temperature": {
"min": -273,
"max": 1000
}
}
Должен конвертироваться в объект типа
class Weather {
@Flatten("temperature::min")
int min_temperture;
@Flatten("temperature::max")
int max_temperture;
}
Hi guys, so i have code like this
public class Parent {
//@Flatten("data::some_object::field")
private String fieldName;
}
public class Child extends Parent{
@Flatten("data::field")
private String anotherField;
}
so the JSON i received when quering for child staff
{
"data":{
"field": "field value"
}
}
The moment i uncomment the annotation on Parant the app stops working with the error
Process: net.innoflash.his_word, PID: 30475
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.gson.JsonElement.isJsonObject()' on a null object reference
Looks like because we do not have that field with nested results, how can i deal with such.
I saw something like this:
@SerializedName(value="name1", alternate={"name2", "name3"}) String b;
it looks like we do not have the alternate
param in @Flatten
if that will help the situation
Thanks
Consider moving into the more permissive Apache license as LGPL is too restrictive to allow using your lib in commercial applications
Just noticed that you commented on noties/Flatten#1 (comment) and want to ask you why do you think your implementation is not very effective ?
Any particular reason why not submitting a pull request to the other project instead of creating a new project ?
This looks awesome by the way :)
Поддерживать аннотацию @FlattenField("path")
и @FlattenField("path", "prefix")
для сворачивания всех полей вложенного объекта в соответствующие поля текущего. Пример,
{
"data": {
"temp": {
"min": -273,
"max": 1000
}
}
}
@FlattenField("data::temp")
class Weather {
int min;
int max;
}
@FlattenField("data::temp", "temp")
class Weather2 {
int tempMin;
int tempMax;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.