code: public String write( JSON json, String encoding ) {
        if( keepArrayName && typeHintsEnabled ){
           throw new IllegalStateException( "Type Hints cannot be used together with 'keepArrayName'" );
        }
        if( JSONNull.getInstance()
              .equals( json ) ){
           Element root = null;
           root = newElement( getRootName() == null ? getObjectName() : getRootName() );
           root.addAttribute( new Attribute( addJsonPrefix( "null" ), "true" ) );
           Document doc = new Document( root );
           return writeDocument( doc, encoding );
        }else if( json instanceof JSONArray ){
           JSONArray jsonArray = (JSONArray) json;
           Element root = processJSONArray( jsonArray,
                 newElement( getRootName() == null ? getArrayName() : getRootName() ),
                 expandableProperties );
           Document doc = new Document( root );
           return writeDocument( doc, encoding );
        }else{
           JSONObject jsonObject = (JSONObject) json;
           Element root = null;
           if( jsonObject.isNullObject() ){
              root = newElement( getObjectName() );
              root.addAttribute( new Attribute( addJsonPrefix( "null" ), "true" ) );
           }else{
              root = processJSONObject( jsonObject,
                    newElement( getRootName() == null ? getObjectName() : getRootName() ),
                    expandableProperties, true );
           }
           Document doc = new Document( root );
           return writeDocument( doc, encoding );
        }
     }
docs: Writes a JSON value into a XML string with an specific encoding.<br>
  If the encoding string is null it will use UTF-8.
  
  @param json The JSON value to transform
  @param encoding The xml encoding to use
  @return a String representation of a well-formed xml document.
  @throws JSONException if the conversion from JSON to XML can't be made for
  I/O reasons or the encoding is not supported.