title: In c# how to split json objects into smaller objects and store in a string array
body: <p>I have to send data in json format, but they have to be of small sizes. I get data(str) as follows</p>
  
  <pre><code>[{"CombinationCode":127,"Pattern":"4545,.86,4520,.44,4592"},{"CombinationCode":128,"Pattern":"4545,.86,4520,.44,4592"},{"CombinationCode":129,"Pattern":"4545,.86,4520,.44,4592"}]
  </code></pre>
  
  <p>If I want the max size to be 165, I want to chunk the data to pieces smaller than 165(maxLength), and a whole json tuple should be included. Like the above should be separated as 2 string arrays</p>
  
  <pre><code> [{"CombinationCode":127,"Pattern":"4545,.86,4520,.44,4592"},{"CombinationCode":128,"Pattern":"4545,.86,4520,.44,4592"}]
  </code></pre>
  
  <p>and</p>
  
  <pre><code>[{"CombinationCode":129,"Pattern":"4545,.86,4520,.44,4592"}]
  </code></pre>
  
  <p>How will I do this. I tried the following code, but it separates it according to only size, and not tuples</p>
  
  <pre><code>for (int index = 0; index &lt; str.Length; index += maxLength) {
      Console.WriteLine("DataPart {0}",str.Substring(index, Math.Min(maxLength, str.Length - index)));
  }
  </code></pre>
  
  <p>Any help will be greatly appreciated.</p>