File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1083,6 +1083,30 @@ json_format_string (const char *text)
10831083 pos ++ ;
10841084 break ;
10851085
1086+ case '[' :
1087+ indentation ++ ;
1088+ rcs_catcs (output , "{\n" , 2 );
1089+ for (i = 0 ; i < indentation ; i ++ )
1090+ {
1091+ rcs_catc (output , '\t' );
1092+ }
1093+ pos ++ ;
1094+ break ;
1095+
1096+ case ']' :
1097+ indentation -- ;
1098+ rcs_catc (output , '\n' );
1099+ // the for loop will compare i with potential negative values
1100+ // so we don't get caught in an infinite loop if the json is faulty with more "}" than "{"
1101+ // we just print out the same number of faulty "}" characters.
1102+ for (i = 0 ; i < indentation ; i ++ )
1103+ {
1104+ rcs_catc (output , '\t' );
1105+ }
1106+ rcs_catc (output , '}' );
1107+ pos ++ ;
1108+ break ;
1109+
10861110 case ':' :
10871111 rcs_catcs (output , ": " , 2 );
10881112 pos ++ ;
You can’t perform that action at this time.
0 commit comments