code: private void renderMBean(JsonGenerator jg, ObjectName objectName) throws IOException {
      MBeanInfo beanInfo;
      String className;
  
      jg.writeObjectFieldStart(objectName.toString());
      jg.writeStringField("beanName", objectName.toString());
  
      try {
        beanInfo = mBeanServer.getMBeanInfo(objectName);
        className = beanInfo.getClassName();
  
        // if we have the generic BaseModelMBean for className, attempt to get
        // more specific name
        if ("org.apache.commons.modeler.BaseModelMBean".equals(className)) {
          try {
            className = (String) mBeanServer.getAttribute(objectName, "modelerType");
          } catch (Exception e) {
            // it's fine if no more-particular name can be found
          }
        }
  
        jg.writeStringField("className", className);
        for (MBeanAttributeInfo attr : beanInfo.getAttributes()) {
          writeAttribute(jg, objectName, attr);
        }
  
      } catch (OperationsException e) {
        // Some general MBean exception occurred.
        writeException(jg, e);
      } catch (ReflectionException e) {
        // This happens when the code inside the JMX bean threw an exception, so
        // log it and don't output the bean.
        writeException(jg, e);
      }
  
      jg.writeEndObject();
    }
docs: Render a particular MBean's attributes to jg.
  
  @param jg
  JsonGenerator that will be written to
  @param objectName
  ObjectName for the mbean to render.
  @return void