code: public String serialize(Object object)
      {
          try {
              ObjectMapper mapper = new ObjectMapper();
              SimpleModule m = new SimpleModule("org.json.* serializer", new Version(1, 0, 0, "", "org.json", "json"));
              m.addSerializer(JSONObject.class, new JSONObjectSerializer());
              m.addSerializer(JSONArray.class, new JSONArraySerializer());
              mapper.registerModule(m);
  
              return mapper.writeValueAsString(object);
          } catch (JsonProcessingException e) {
              LOGGER.error("Failed to serialize object to JSON", e);
          }
  
          return null;
      }
docs: Serialize a Java object to the JSON format.
  <p>
  Examples:
  <ul>
  <li>numbers and boolean values: 23, 13.5, true, false</li>
  <li>strings: "one\"two'three" (quotes included)</li>
  <li>arrays and collections: [1, 2, 3]</li>
  <li>maps: {"number": 23, "boolean": false, "string": "value"}</li>
  <li>beans: {"enabled": true, "name": "XWiki"} for a bean that has #isEnabled() and #getName() getters</li>
  </ul>
  
  @param object the object to be serialized to the JSON format
  @return the JSON-verified string representation of the given object