我在循环中的字符串 ResultedValue 中从 Web 服务中获得了结果,如下面的代码所示,
for (int j = 0; j < value.Count; j++)
{
var xmlAttributeCollection_for_period = value[i].Attributes;
if (xmlAttributeCollection != null)
{
var periodid = xmlAttributeCollection_for_period["periodid"];
xmlActions[i] = periodid.Value;
period_final_id = periodid.Value;
string period_name = Client.GetAttributeAsString(
sessionId, periodid.Value, "name", "");
var action = xmlAttributeCollection_for_period["value"];
xmlActionsone[i] = action.Value;
period_final_value = action.Value;
values += final_resulted_series_name+":"+period_name + ":"
+ action.Value + ",";
string vals = values.Split(',')[1];
counts = values;
string[] periods = counts.Split(',');
Period1 = periods[i];
// string final_resulted_period_name = Client.GetAttributeAsString(sessionId, resulted_series_id, "name", "");
resulted_value = final_resulted_series_name + ":" + period_name
+ ":" + period_final_value;
modified_listofstrings.Add(resulted_value);
json = JsonConvert.SerializeObject(modified_listofstrings);
//changed_json = json;
}
}
我想在使用时以任何外部 JSON 文件格式存储 ResultedValue 的每个值
json = JsonConvert.SerializeObject(modified_listofstrings);
它在字符串本身中给我输出为 ["Target:Q1/2013:17"],我不知道我将如何存储在外部文件中,因为我是 JSON 新手,所以我无法完成它,我会要求请向我提供任何帮助链接