string CjsonA::AddTypeValue(string strResult,int *nInsert,BOOL ifFirst,string strField,Cjson TypeValue,string NewLineSign,string FormatSign,int FormatLength){ int length = FormatLength; string strFormatSign = ""; while(length--!=0){ strFormatSign = strFormatSign + FormatSign; } string strOne = strFormatSign + "\"" + strField + "\""; if(TypeValue.type == "class CstrValue"){ CstrValue strValueTemp = TypeValue.toValue(); //字符串 if(strValueTemp.type == 1){ strOne = strOne + " : \"" + strValueTemp.strValue + "\""; } //整数和小数 if(strValueTemp.type == 2 || strValueTemp.type == 3){ strOne = strOne + " : " + strValueTemp.strValue; } } if(TypeValue.type == "class CszValue"){ CszValue szValue = TypeValue.tosz(); string strszValue = ""; int i = -1; while(i++ != szValue.size() - 1){ if(i != 0) strszValue = strszValue + ","; Cjson TypeValueTemp = szValue.vecszValue.at(i); if(TypeValueTemp.type == "class CstrValue"){ CstrValue strValueTemp = TypeValueTemp.toValue(); //字符串 if(strValueTemp.type == 1){ strszValue = strszValue + "\"" + strValueTemp.strValue + "\""; } //整数和小数 if(strValueTemp.type == 2 || strValueTemp.type == 3){ strszValue = strszValue + strValueTemp.strValue; } } if(TypeValueTemp.type == "class CjsonA"){ CjsonA jsonTemp = TypeValueTemp.toJson(); string strResultTemp = jsonTemp.tostring(NewLineSign,FormatSign,FormatLength + 1); strszValue = strszValue + strResultTemp; } } strOne = strOne + " : [" + strszValue + "]";//空数组 } if(TypeValue.type == "class CjsonA"){ CjsonA jsonTemp = TypeValue.toJson(); string strResultTemp = jsonTemp.tostring(NewLineSign,FormatSign,FormatLength + 1); strOne = strOne + " : " + strResultTemp; } if(ifFirst == 1){ strOne = NewLineSign + strOne; } else{ strOne = "," + NewLineSign + strOne; } CStringManager::Insert(strResult,*nInsert,strOne); *nInsert = *nInsert + CStringManager::GetLength(strOne); return strResult; }