Create JSON object using Jackson in Java
<p>I need to create a JSON string as below using Jackson.
I know similar question has been answered already here:     <a href="https://stackoverflow.com/questions/16974474/creating-a-json-object-using-jackson">Creating a json object using jackson</a></p>

<p>But my expected JSON string is a little different from the one in above example.</p>

<p>How can I form the below formatted JSON object in Java using only Jackson?
Also, I do not prefer creating a separate POJO to achieve this.</p>

<p>Expected Output:</p>

<pre><code>{
    "obj1": {
        "name1": "val1",
        "name2": "val2"
    },
    "obj2": {
        "name3": "val3",
        "name4": "val4"
    },
    "obj3": {
        "name5": "val5",
        "name6": "val6"
    }
}
</code></pre>