Could not determine JSON object type for type "Class"
<p>I got the following error while trying to add an object of type class to the <strong>JArray</strong>.</p>
<blockquote>
<p>Could not determine JSON object type for type &quot;Class&quot;</p>
</blockquote>
<p>Here is my code:</p>
<pre class="lang-cs prettyprint-override"><code>private dynamic _JArray = null

private JArray NArray(Repository repository)
{
    _JArray = new JArray();

    string[] amounts = repository.Amounts.Split('|');

    for (int i = 0; i &lt;= amounts.Length; i++)
    {
        _JArray.Add(new AmountModel
                    {
                        Amounts = amounts[i],
                    });
    }

    return _JArray;
}

public class AmountModel
{
    public string Amounts;
}

</code></pre>
<p>Here's how I call it :</p>
<pre class="lang-cs prettyprint-override"><code>_JArray = NArray(repository);

Console.WriteLine(JsonConvert.SerializeObject(_JArray));
</code></pre>
<p>How can I convert the <strong>AmountModel (class)</strong> inside of <strong>_JArray (JArray)</strong>, to be recognized by the system as JSON object?</p>
<p>Your answer much appreciated.</p>
<p>Thank you.</p>