src/json.c

changeset 1079
4e1872151fb6
parent 1078
ffa8bb4e9288
child 1082
46cdc8689fc4
equal deleted inserted replaced
1078:ffa8bb4e9288 1079:4e1872151fb6
921 static const CxJsonWriter cx_json_writer_default = { 921 static const CxJsonWriter cx_json_writer_default = {
922 false, 922 false,
923 true, 923 true,
924 255, 924 255,
925 false, 925 false,
926 4, 926 4
927 false,
928 80
929 }; 927 };
930 928
931 CxJsonWriter cxJsonWriterCompact(void) { 929 CxJsonWriter cxJsonWriterCompact(void) {
932 return cx_json_writer_default; 930 return cx_json_writer_default;
933 } 931 }
936 return (CxJsonWriter) { 934 return (CxJsonWriter) {
937 true, 935 true,
938 true, 936 true,
939 255, 937 255,
940 use_spaces, 938 use_spaces,
941 4, 939 4
942 false,
943 80
944 }; 940 };
945 } 941 }
946 942
947 static int cx_json_writer_indent( 943 static int cx_json_writer_indent(
948 void *target, 944 void *target,
1000 actual += wfunc(begin_obj, 1, 1, target); 996 actual += wfunc(begin_obj, 1, 1, target);
1001 expected++; 997 expected++;
1002 } 998 }
1003 depth++; 999 depth++;
1004 CxIterator iter = cxJsonObjIter(value); 1000 CxIterator iter = cxJsonObjIter(value);
1001 // TODO: unsorted output - realize after implementing index array
1005 cx_foreach(CxJsonObjValue*, member, iter) { 1002 cx_foreach(CxJsonObjValue*, member, iter) {
1006 // possible indentation 1003 // possible indentation
1007 if (settings->pretty) { 1004 if (settings->pretty) {
1008 if (cx_json_writer_indent(target, wfunc, settings, depth)) return 1; 1005 if (cx_json_writer_indent(target, wfunc, settings, depth)) return 1;
1009 } 1006 }

mercurial