title: Jackson : Serialize a JSON object to multiple objects
body: <p>I'm given a string which represents a json object of type <code>Map&lt;String, String&gt;</code>. There is a constraint on the number of characters in one json object. I would have to convert the json object into Array of multiple json objects, if the number of characters in the JSON object exceeds the specified limit. What is the easiest and clean way of doing this using Jackson Mapper?</p>
  
  <p>For example:
  if this is the json object given is:</p>
  
  <pre><code>{
     "cfname":"Kob",
     "NAME_6":"Philharmonic Youth Orchestra",
     "NAME_5":"Pathways to Discovery: Engineering, Medicine &amp; CSI",
     "NAME_4":"Fashion Design Camp",
     "IMAGE_URL_1":"http://res.cloudinary.com/pxxxxxx-jxxxxxx/image/upload/c_fill,h_230,w_260/v0000000000/vccrgwdekjkpdvpsrv4f.jpg",
     "IMAGE_URL_2":"http://res.cloudinary.com/pxxxxxx-jxxxxxx/image/upload/c_fill,h_230,w_260/v0000000000/wlom2u5525nyjjbttazw.jpg"
  }
  </code></pre>
  
  <p>if the character count limit for one json object is 200. Then the output would be:</p>
  
  <pre><code>[
         {
            "cfname":"Kob",
            "NAME_6":"Philharmonic Youth Orchestra",
            "NAME_5":"Pathways to Discovery: Engineering, Medicine &amp; CSI",
            "NAME_4":"Fashion Design Camp"
         },
         {
            "IMAGE_URL_1":"http://res.cloudinary.com/pxxxxxx-jxxxxxx/image/upload/c_fill,h_230,w_260/v0000000000/vccrgwdekjkpdvpsrv4f.jpg"
         },
         {
            "IMAGE_URL_2":"http://res.cloudinary.com/pxxxxxx-jxxxxxx/image/upload/c_fill,h_230,w_260/v0000000000/wlom2u5525nyjjbttazw.jpg"
         }
  ]
  </code></pre>
  
  <ol>
  <li>We can assume that the length of any key-value pair in the given json object will be less than given character count limit.</li>
  <li>we should ignore whitespaces and new line characters while counting characters.</li>
  </ol>
  
  <p>Usecase : 
     I have to add these json objects as a header to the email. Since smtp has a character limit of 1000 for each header value. I have to break it up into multiple json objects, each json object will be one header value.   </p>