JsonConvert.SerializeObject()
导致我的JSON字符串格式错误。我开始将对象序列化如下:
public List<AccountTypeObject> Creator()
{
for (int i = 1; i < 4; ++i)
{
for (int j = 1; j < 11; ++j)
{
if ((i % 2) == 0)
{
AllTransactionsList.Add(new SingleTransactionObject(j + 101 + j,
"I'am putting in money right now", "1500" + j, "0",
DateTime.Now.ToString(), DateTime.Now.ToString()));
}
else
{
AllTransactionsList.Add(new SingleTransactionObject(j + 101 + j,
"I need money right now", "500" + j, "0",
DateTime.Now.ToString(), DateTime.Now.ToString()));
}
}
AllAccountTypesList.Add(new AccountTypeObject(i + "55" + i + "632" + i,
i + "MACMONSAM NICOLAS", +i + "100,000.00", AllTransactionsList));
}
return AllAccountTypesList;
}
当我应用此代码时:
// GET api/uconnectservice
public String Get()
{
var json = JsonConvert.SerializeObject(new
{
operations = sampledata.GetAllDummy(),
});
return json;
}
运行此服务后,我得到了这个JSON字符串:
"{\"operations\":[{\"AccountType\":\"15516321\",\"CustomerName\":\"1MACMONSAM NICOLAS\",\"Currentbalance\":\"1100,000.00\",\"AllTransactions\":[{\"ID\":103,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"50010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":103,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"150010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":103,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"50010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"}]},{\"AccountType\":\"25526322\",\"CustomerName\":\"2MACMONSAM NICOLAS\",\"Currentbalance\":\"2100,000.00\",\"AllTransactions\":[{\"ID\":103,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"50010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":103,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"150010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":103,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"50010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"}]},{\"AccountType\":\"35536323\",\"CustomerName\":\"3MACMONSAM NICOLAS\",\"Currentbalance\":\"3100,000.00\",\"AllTransactions\":[{\"ID\":103,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"50010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":103,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"150010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":103,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"50010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"}]}]}"
然而,当我转到here和here时,我被告知存在字符串解析错误。
我该如何解决这个问题?
答案 0 :(得分:0)
你json有效,你需要使用JSON.parse
将数据转换为json object
var data = "{\"operations\":[{\"AccountType\":\"15516321\",\"CustomerName\":\"1MACMONSAM NICOLAS\",\"Currentbalance\":\"1100,000.00\",\"AllTransactions\":[{\"ID\":103,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"50010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":103,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"150010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":103,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"50010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"}]},{\"AccountType\":\"25526322\",\"CustomerName\":\"2MACMONSAM NICOLAS\",\"Currentbalance\":\"2100,000.00\",\"AllTransactions\":[{\"ID\":103,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"50010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":103,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"150010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":103,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"50010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"}]},{\"AccountType\":\"35536323\",\"CustomerName\":\"3MACMONSAM NICOLAS\",\"Currentbalance\":\"3100,000.00\",\"AllTransactions\":[{\"ID\":103,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"50010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":103,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"15009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I'am putting in money right now\",\"Debit\":\"150010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":103,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5001\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":105,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5002\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":107,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5003\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":109,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5004\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":111,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5005\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":113,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5006\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":115,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5007\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":117,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5008\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":119,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"5009\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"},{\"ID\":121,\"DescriptionoOfTransaction\":\"I need money right now\",\"Debit\":\"50010\",\"Credit\":\"0\",\"TransactionDate\":\"15/12/2016 11:40:24\",\"ValueDate\":\"15/12/2016 11:40:24\"}]}]}";
var json = JSON.parse(data);
答案 1 :(得分:0)
您展示的是字符串的C#Debug或Watch输出,由""
包围,所有内部"
转义为\"
。
似乎你把这个 as-is 提供给两个解析器,结果他们说它是无效的,而且肯定是。在我解除了逃逸并删除了周围的引号后,将其输入两个解析器中,然后一切都以漂亮的颜色传递。所以经验教训是,使用Debug或Watch输出时要小心。
答案 2 :(得分:0)
我注意到你在你的json字符串中有一个',这不是一个json字符串这就是为什么你得到字符串解析错误,你需要删除所有\,也删除起始结尾“(它们是由Visual添加的工作室,当你看到我认为正确的json内容?,因为你的序列化是好的,它没有任何问题)。 我这样做了并得到了以下内容:
{"operations":[{"AccountType":"15516321","CustomerName":"1MACMONSAM NICOLAS","Currentbalance":"1100,000.00","AllTransactions":[{"ID":103,"DescriptionoOfTransaction":"I need money right now","Debit":"5001","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":105,"DescriptionoOfTransaction":"I need money right now","Debit":"5002","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":107,"DescriptionoOfTransaction":"I need money right now","Debit":"5003","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":109,"DescriptionoOfTransaction":"I need money right now","Debit":"5004","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":111,"DescriptionoOfTransaction":"I need money right now","Debit":"5005","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":113,"DescriptionoOfTransaction":"I need money right now","Debit":"5006","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":115,"DescriptionoOfTransaction":"I need money right now","Debit":"5007","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":117,"DescriptionoOfTransaction":"I need money right now","Debit":"5008","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":119,"DescriptionoOfTransaction":"I need money right now","Debit":"5009","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":121,"DescriptionoOfTransaction":"I need money right now","Debit":"50010","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":103,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15001","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":105,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15002","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":107,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15003","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":109,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15004","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":111,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15005","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":113,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15006","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":115,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15007","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":117,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15008","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":119,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15009","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":121,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"150010","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":103,"DescriptionoOfTransaction":"I need money right now","Debit":"5001","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":105,"DescriptionoOfTransaction":"I need money right now","Debit":"5002","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":107,"DescriptionoOfTransaction":"I need money right now","Debit":"5003","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":109,"DescriptionoOfTransaction":"I need money right now","Debit":"5004","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":111,"DescriptionoOfTransaction":"I need money right now","Debit":"5005","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":113,"DescriptionoOfTransaction":"I need money right now","Debit":"5006","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":115,"DescriptionoOfTransaction":"I need money right now","Debit":"5007","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":117,"DescriptionoOfTransaction":"I need money right now","Debit":"5008","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":119,"DescriptionoOfTransaction":"I need money right now","Debit":"5009","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":121,"DescriptionoOfTransaction":"I need money right now","Debit":"50010","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"}]},{"AccountType":"25526322","CustomerName":"2MACMONSAM NICOLAS","Currentbalance":"2100,000.00","AllTransactions":[{"ID":103,"DescriptionoOfTransaction":"I need money right now","Debit":"5001","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":105,"DescriptionoOfTransaction":"I need money right now","Debit":"5002","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":107,"DescriptionoOfTransaction":"I need money right now","Debit":"5003","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":109,"DescriptionoOfTransaction":"I need money right now","Debit":"5004","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":111,"DescriptionoOfTransaction":"I need money right now","Debit":"5005","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":113,"DescriptionoOfTransaction":"I need money right now","Debit":"5006","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":115,"DescriptionoOfTransaction":"I need money right now","Debit":"5007","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":117,"DescriptionoOfTransaction":"I need money right now","Debit":"5008","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":119,"DescriptionoOfTransaction":"I need money right now","Debit":"5009","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":121,"DescriptionoOfTransaction":"I need money right now","Debit":"50010","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":103,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15001","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":105,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15002","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":107,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15003","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":109,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15004","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":111,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15005","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":113,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15006","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":115,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15007","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":117,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15008","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":119,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15009","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":121,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"150010","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":103,"DescriptionoOfTransaction":"I need money right now","Debit":"5001","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":105,"DescriptionoOfTransaction":"I need money right now","Debit":"5002","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":107,"DescriptionoOfTransaction":"I need money right now","Debit":"5003","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":109,"DescriptionoOfTransaction":"I need money right now","Debit":"5004","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":111,"DescriptionoOfTransaction":"I need money right now","Debit":"5005","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":113,"DescriptionoOfTransaction":"I need money right now","Debit":"5006","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":115,"DescriptionoOfTransaction":"I need money right now","Debit":"5007","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":117,"DescriptionoOfTransaction":"I need money right now","Debit":"5008","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":119,"DescriptionoOfTransaction":"I need money right now","Debit":"5009","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":121,"DescriptionoOfTransaction":"I need money right now","Debit":"50010","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"}]},{"AccountType":"35536323","CustomerName":"3MACMONSAM NICOLAS","Currentbalance":"3100,000.00","AllTransactions":[{"ID":103,"DescriptionoOfTransaction":"I need money right now","Debit":"5001","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":105,"DescriptionoOfTransaction":"I need money right now","Debit":"5002","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":107,"DescriptionoOfTransaction":"I need money right now","Debit":"5003","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":109,"DescriptionoOfTransaction":"I need money right now","Debit":"5004","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":111,"DescriptionoOfTransaction":"I need money right now","Debit":"5005","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":113,"DescriptionoOfTransaction":"I need money right now","Debit":"5006","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":115,"DescriptionoOfTransaction":"I need money right now","Debit":"5007","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":117,"DescriptionoOfTransaction":"I need money right now","Debit":"5008","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":119,"DescriptionoOfTransaction":"I need money right now","Debit":"5009","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":121,"DescriptionoOfTransaction":"I need money right now","Debit":"50010","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":103,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15001","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":105,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15002","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":107,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15003","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":109,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15004","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":111,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15005","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":113,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15006","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":115,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15007","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":117,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15008","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":119,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"15009","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":121,"DescriptionoOfTransaction":"I'am putting in money right now","Debit":"150010","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":103,"DescriptionoOfTransaction":"I need money right now","Debit":"5001","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":105,"DescriptionoOfTransaction":"I need money right now","Debit":"5002","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":107,"DescriptionoOfTransaction":"I need money right now","Debit":"5003","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":109,"DescriptionoOfTransaction":"I need money right now","Debit":"5004","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":111,"DescriptionoOfTransaction":"I need money right now","Debit":"5005","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":113,"DescriptionoOfTransaction":"I need money right now","Debit":"5006","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":115,"DescriptionoOfTransaction":"I need money right now","Debit":"5007","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":117,"DescriptionoOfTransaction":"I need money right now","Debit":"5008","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":119,"DescriptionoOfTransaction":"I need money right now","Debit":"5009","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"},{"ID":121,"DescriptionoOfTransaction":"I need money right now","Debit":"50010","Credit":"0","TransactionDate":"15/12/2016 11:40:24","ValueDate":"15/12/2016 11:40:24"}]}]}
将您的方法更改为:
public IHttpActionResult Get()
{
return Ok(sampledata.GetAllDummy());
}
您不必执行任何json序列化,框架将为您完成。