title: Lombok/Jackson - POJO for a json array
body: <p>I have a json array that I need to receive(de-serialize) from a server and send (serialize) to another server:</p>
  
  <p><strong>Example:</strong></p>
  
  <pre><code>[
    {
      "car-name": "string",
      "parts": [
        "engine",
        "wheels"
      ]
    }
  ]
  </code></pre>
  
  <p>I started with writing the following POJO to represent this Json array:</p>
  
  <pre><code>import lombok.Builder;
  import lombok.Singular;
  import lombok.Value;
  
  
  @Builder
  @Value
  public class Car {
  
      private String carName;
      @Singular("part")
      private List&lt;String&gt; parts;
  }
  </code></pre>
  
  <p>With this:</p>
  
  <ol>
  <li>I am able to build the object using Lombok as: </li>
  </ol>
  
  <p><code>Car myCar = Car.builder().carName("Tesla").part("engine").part("wheels").build();</code></p>
  
  <ol start="2">
  <li>Unmarshal using something like <code>unmarshal().json(Jackson, Car.class)</code>.</li>
  </ol>
  
  <p>While 1) and 2) work, they do NOT give me objects that actually represent the json example above. </p>
  
  <p>They instead give this:</p>
  
  <pre><code>  {
      "car-name": "string",
      "parts": [
        "engine",
        "wheels"
      ]
    }
  </code></pre>
  
  <p>I tried using a parent class as below:</p>
  
  <pre><code>import lombok.Builder;
  import lombok.Singular;
  import lombok.Value;
  
  @Builder
  @Value
  public class Vehicle {
  
      private List&lt;Car&gt; vehicles;
  }
  </code></pre>
  
  <p>But this also gives me a wrong object (notice the "vehicles" key Vs what I have in my above Example):</p>
  
  <pre><code>  {
      "vehicles": {
          "car-name": "string",
          "parts": [
               "engine",
               "wheels"
               ]
          }
  }
  </code></pre>
  
  <p>How can I write a POJO that represents this JSON array, preferably using Lombok? Or Jackson? </p>