private void beforeValue() throws JSONException {
  if (stack.isEmpty()) {
    return;
  }
  Scope context=peek();
  if (context == Scope.EMPTY_ARRAY) {
    replaceTop(Scope.NONEMPTY_ARRAY);
    newline();
  }
 else   if (context == Scope.NONEMPTY_ARRAY) {
    out.append(',');
    newline();
  }
 else   if (context == Scope.DANGLING_KEY) {
    out.append(indent == null ? ":" : ": ");
    replaceTop(Scope.NONEMPTY_OBJECT);
  }
 else   if (context != Scope.NULL) {
    throw new JSONException("Nesting problem");
  }
}

private void beforeValue ( ) throws JSONException { if ( stack . isEmpty ( ) ) { return ; } Scope context = peek ( ) ; if ( context == Scope . EMPTY_ARRAY ) { replaceTop ( Scope . NONEMPTY_ARRAY ) ; newline ( ) ; } else if ( context == Scope . NONEMPTY_ARRAY ) { out . append ( ',' ) ; newline ( ) ; } else if ( context == Scope . DANGLING_KEY ) { out . append ( indent == null ? ":" : ": " ) ; replaceTop ( Scope . NONEMPTY_OBJECT ) ; } else if ( context != Scope . NULL ) { throw new JSONException ( "Nesting problem" ) ; } }
inserts any necessary separators and whitespace before a literal value , inline array , or inline object . also adjusts the stack to expect either a closing bracket or another element .
