title: Adding fields to Jackson's JsonNode
body: <p>I have a Java object represented as JSON and I want to add additional fields to the JSON. I don't want to add these fields to the Java model, I just need to add them to the JSON before it is processed.</p>
  
  <p>Here is a simplified version of what I have at the moment:</p>
  
  <pre><code>public void addAdditionalFields(JsonNode myObjectAsJsonNode) {
  
      JsonFactory jsonFactory = new JsonFactory();
      JsonGenerator jgen = jsonFactory.createJsonGenerator(new StringWriter());
      jgen.writeStartObject();
      jgen.writeObjectField("test", "myFieldsValue");
      jgen.writeEndObject();
  
      jacksonObjectMapper.writeTree(jgen, myObjectAsJsonNode);
  }
  </code></pre>
  
  <p>The new field isn't added to the <code>myObjectAsJsonNode</code> object.</p>