google / google/gson

How recursively update embedded objects on deserialization into existed object instead of rewrite it?

Open
#1,450 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
Java
Stars
24.2k
Forks
4.5k
Avg merge
6d 4h
Merged PRs (30d)
12

Description

I'll show you an example:

valueToUpdate:
```
class Person{
String name; //"Michael"
Address address;
}

class Address{
String street; //"Kitano"
Integer home; //5
}
```
source in json:
```
{
name: "Bob"
address: {
street: "Abbey Road"
//!!! there is no 'home' value !!!
}
}
```
and as a result i want get:
```
class Person{
String name; //"Bob"
Address address;
}

class Address{
String street; //"Abbey Road"
Integer home; //5 - !!! the value remains the same !!!
}
```

Can I get similar functionality using Gson? What do I need to use? I can close this issue by myself. I only need clues for find needed objects.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.