How to use nested builder pattern in json?

166 views Asked by At

I have a JSON object:

[
  {
    "name": "abc",
    "category": "developer",
    "Address": [
      {
        "street": "xxx"
      },
      {
        "street": "yyy"
      }
    ]
  },
  ........
]

I am using builder pattern to build Address as well as the object of this array. How can I append one more street in Address in this structure (given name is unique across different objects of this array.

Note: As I am using builder pattern so I can not access fields of this object using getters.

0

There are 0 answers