There's "nothing wrong" ...
I ran a test using the same code base as yours:
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace TesteConsole
{
class Program
{
static void Main(string[] args)
{
var lista = new List<Teste>();
for (int i = 0; i < 300; i++)
lista.Add(new Teste{id = i, nome = "Teste "+ i});
var json = JsonConvert.SerializeObject(lista);
Console.WriteLine(json);
string result = string.Empty;
foreach (var item in lista)
{
result += JsonConvert.SerializeObject(item);
}
Console.WriteLine(result);
Console.ReadLine();
}
}
}
public class Teste
{
public int id { get; set; }
public string nome { get; set; }
}
Result of var json = JsonConvert.SerializeObject(lista)
:
[{"id":0,"nome":"Teste 0"},{"id":1,"nome":"Teste 1"},{"id":2,"nome":"Teste 2"},{"id":3,"nome":"Teste 3"},{"id":4,"nome":"Teste 4"}
[...]
{"id":297,"nome":"Teste 297"},{"id":298,"nome":"Teste 298"},{"id":299,"nome":"Teste 299"}]
Result of string result
:
{"id":0,"nome":"Teste 0"}{"id":1,"nome":"Teste 1"}{"id":2,"nome":"Teste 2"}{"id":3,"nome":"Teste 3"}{"id":4,"nome":"Teste 4"}
[...]
{"id":297,"nome":"Teste 297"}{"id":298,"nome":"Teste 298"}{"id":299,"nome":"Teste 299"}
I think the problem is only in the visualization and familiarization of the IDE ... If you in debug mode "hover" on top of the variable you want to see, you will see a reticence in case of what you are inspecting have a content larger than "fit" in the inspection preview:
05.04.2016 / 16:47