public void toJsonEntryHelper(Entry entry,StringBuilder result,int level,boolean notTheFirst,boolean skipFirstLinefeed){
  if (notTheFirst) {
    result.append(",\n");
  }
  if (!skipFirstLinefeed)   appendIndentation(level,result);
  result.append("{\n");
  ++level;
  boolean addedAnyYet=false;
  addedAnyYet=JsonBuilder.addPropertyToJsonString(result,entry.getId(),addedAnyYet,"id",level);
  addedAnyYet=JsonBuilder.addPropertyToJsonString(result,entry.getNote(),addedAnyYet,"note",level);
  addedAnyYet=JsonBuilder.addPropertyToJsonString(result,entry.getFirstChildId(),addedAnyYet,"firstChild",level);
  addedAnyYet=JsonBuilder.addPropertyToJsonString(result,entry.getLastChildId(),addedAnyYet,"lastChild",level);
  addedAnyYet=JsonBuilder.addPropertyToJsonString(result,entry.getPreviousSiblingId(),addedAnyYet,"previousSibling",level);
  addedAnyYet=JsonBuilder.addPropertyToJsonString(result,entry.getNextSiblingId(),addedAnyYet,"nextSibling",level);
  ArrayList<Entry> childrenEntries=getChildrenInOrder(entry);
  if (!childrenEntries.isEmpty()) {
    result.append(",\n");
    appendIndentation(level,result);
    result.append("\"children\": [\n");
    boolean notTheFirstChild=false;
    for (    Entry childEntry : childrenEntries) {
      toJsonEntryHelper(childEntry,result,level + 1,notTheFirstChild,false);
      notTheFirstChild=true;
    }
    result.append("\n");
    appendIndentation(level,result);
    result.append("]");
  }
  --level;
  result.append("\n");
  appendIndentation(level,result);
  result.append("}");
}

public void toJsonEntryHelper ( Entry entry , StringBuilder result , int level , boolean notTheFirst , boolean skipFirstLinefeed ) { if ( notTheFirst ) { result . append ( ",\n" ) ; } if ( ! skipFirstLinefeed ) appendIndentation ( level , result ) ; result . append ( "{\n" ) ; ++ level ; boolean addedAnyYet = false ; addedAnyYet = JsonBuilder . addPropertyToJsonString ( result , entry . getId ( ) , addedAnyYet , "id" , level ) ; addedAnyYet = JsonBuilder . addPropertyToJsonString ( result , entry . getNote ( ) , addedAnyYet , "note" , level ) ; addedAnyYet = JsonBuilder . addPropertyToJsonString ( result , entry . getFirstChildId ( ) , addedAnyYet , "firstChild" , level ) ; addedAnyYet = JsonBuilder . addPropertyToJsonString ( result , entry . getLastChildId ( ) , addedAnyYet , "lastChild" , level ) ; addedAnyYet = JsonBuilder . addPropertyToJsonString ( result , entry . getPreviousSiblingId ( ) , addedAnyYet , "previousSibling" , level ) ; addedAnyYet = JsonBuilder . addPropertyToJsonString ( result , entry . getNextSiblingId ( ) , addedAnyYet , "nextSibling" , level ) ; ArrayList < Entry > childrenEntries = getChildrenInOrder ( entry ) ; if ( ! childrenEntries . isEmpty ( ) ) { result . append ( ",\n" ) ; appendIndentation ( level , result ) ; result . append ( "\"children\": [\n" ) ; boolean notTheFirstChild = false ; for ( Entry childEntry : childrenEntries ) { toJsonEntryHelper ( childEntry , result , level + 1 , notTheFirstChild , false ) ; notTheFirstChild = true ; } result . append ( "\n" ) ; appendIndentation ( level , result ) ; result . append ( "]" ) ; } -- level ; result . append ( "\n" ) ; appendIndentation ( level , result ) ; result . append ( "}" ) ; }
helper method . converts an entry to a json string .
