public JSONBuilder quote ( String value ) { _sb . append ( ' ' ) ; for ( int i = 0 ; i < value . length ( ) ; ++ i ) { char c = value . charAt ( i ) ; switch ( c ) { case ' ' : _sb . append ( "\\\"" ) ; break ; case ' ' : _sb . append ( "\\\\" ) ; break ; default : if ( c < 0x20 ) { _sb . append ( CTRLCHARS [ c ] ) ; } else { _sb . append ( c ) ; } break ; } } _sb . append ( ' ' ) ; return this ; }
Quotes properly a string and appends it to the JSON stream .