Creating JSON string in AngularJS
<p>I want to create a JSON string in the following format as below using AngularJS:</p>

<pre><code>{
    "userid": 100,
    "fleetid": 506,
    "comments": "This is a test comment",
    "fleetcheckdate": "29/10/1976",
    "options": [{
        "fleetcheckid": "1",
        "fleetcheckvalueid": "1"
    }, {
        "fleetcheckid": "2",
        "fleetcheckvalueid": "1"
    }, {
        "fleetcheckid": "3",
        "fleetcheckvalueid": "1"
    }]
}
</code></pre>

<p>Where</p>

<ul>
<li>"userid"</li>
<li>"fleetid"</li>
<li>"comments"</li>
<li>"fleetcheckdate"</li>
</ul>

<p>are all separate values know to me.</p>

<p>For <em>"options"</em> I have a multi-dimensional array that stores the values for <em>"fleetcheckid"</em> and <em>"fleetcheckvalueid"</em> that I create as follows:</p>

<pre><code>$scope.selectedRadioArray = [];

$scope.doSomething = function(fleetCheckItemID, fleetCheckID)
{
    $scope.selectedIDS = [fleetCheckItemID, fleetCheckID];
    $scope.selectedRadioArray.push($scope.selectedIDS);
    console.log("Array: " + $scope.selectedRadioArray); // Prints e.g. 4,3,8,6,34,8
}
</code></pre>

<p>The doSomething() method is fired each time the user interacts with a button and this generates the 2 values <em>"fleetcheckid"</em> and <em>"fleetcheckvalueid"</em>. In the example above the user has clicked the button 3 times. The button can be clicked any number of times.</p>

<p>How do I convert the information above into a JSON string as per the example that I can send to my Database via a $http.post()? </p>