@@ -59,13 +59,7 @@ void printString(const struct JsonString* str, const int color) {
5959 fputc ('"' , f );
6060 char * reader = str -> str ;
6161 while (* reader ) {
62- if (* reader == '\n' ) fputs ("\\n" , f );
63- else if (* reader == '\t' ) fputs ("\\t" , f );
64- else if (* reader == '\r' ) fputs ("\\r" , f );
65- else if (* reader == '"' ) fputs ("\\\"" , f );
66- else if (* reader == '\'' ) fputs ("\\'" , f );
67- else fputc (* reader , f );
68-
62+ fputc (* reader , f );
6963 reader ++ ;
7064 }
7165 fputc ('"' , f );if (color ) fputs (ANSI_COLOR_RESET , f );
@@ -121,17 +115,16 @@ void printNONE(const int color) {
121115}
122116
123117void printObject (const struct JsonObj * obj , const int color ){
124- fputc ( '{' , f );
118+ fputs ( "{" , f );
125119 for (int i = 0 ; i < obj -> size ; i ++ ) {
126120 if (color ) {
127121 fputs (ANSI_COLOR_MAGENTA , f );
128- printString (obj -> key + i , color );
122+ printString (obj -> key + i , 0 );
129123 fputs (ANSI_COLOR_RESET , f );
130- }else printString (obj -> key + i , color );
131- putc (':' , f );
132- printJsonVal (obj -> value + i , color );
133- if (i != obj -> size - 1 ) fputc (',' , f );
134- } fputc ('}' , f );
124+ }else printString (obj -> key + i , 0 );
125+ fputs (": " , f ); printJsonVal (obj -> value + i , color );
126+ if (i != obj -> size - 1 ) fputs ("," , f );
127+ }fputs ("}" , f );
135128}
136129void printArray (const struct JsonArray * array , const int color ){
137130 fputc ('[' , f );
0 commit comments