public static void writeJSON( Writer writer, String string )
	throws IOException {

    	writer.write( '"' );
	
	for( int i = 0; i < string.length(); i++ ) {
	    
	    char c = string.charAt(i);
	    switch( c ) {
		// There are double quotation marks, so there is no need to escape single quotes.
		// Additionally escaping ' is not part of the JSON specification!
		// case '\'': writer.write( "\\'" ); break;
	    case '"': writer.write( "\\\"" ); break;
	    case '\n': writer.write( "\\n" ); break;
	    case '\t': writer.write( "\\t" ); break;
	    case '\b': writer.write( "\\b" ); break; 
		// Escape unicode chars?
	    default: writer.write( c ); break;
	    }

	}
	
	writer.write( '"' );
    }