How to resolve error: An unexpected 'StartArray' node was found when reading from the JSON reader. A 'StartObject' node
Date : March 29 2020, 07:55 AM
I wish this help you As stated in the error, you should POST a JSON object, not an array. I believe the change you need is to change: toJSON(): any[] {
let json = [];
json[0] = {
//...
toJSON(): any[] {
let json = {
//...
|
Unexpected JSON token when reading DataTable. Expected StartArray, got StartObject
Date : March 29 2020, 07:55 AM
wish help you to fix your issue The Json you showed is invalid. It should look like this, to be load to the DataSet: {
"Item": [
{
"Name": "Super Mario Bros",
"Count": "14",
"Price": "29,99",
"Comment": "-No Comment-",
"Artist": "N/A",
"Publisher": "Nintendo",
"Genre": "Video Games",
"Year": "1985",
"ProductID": "001"
},
{
"Name": "The Legend of Zelda",
"Count": "12",
"Price": "34,99",
"Comment": "-No Comment-",
"Artist": "N/A",
"Publisher": "Nintendo",
"Genre": "Video Games",
"Year": "1986",
"ProductID": "002"
}
]
}
var dataSet = JsonConvert.DeserializeObject<DataSet>(jsonText);
var table = dataSet.Tables[0];
|
C# An unexpected 'StartObject' node was found for property 'InputArguments' when reading from the JSON reader. A 'Primit
Tag : chash , By : rhyhann
Date : March 29 2020, 07:55 AM
this one helps. This seems to be a question of reading the API documentation carefully. Assuming you are trying to call an orchestrator as described here, I find this example that looks a lot like yours. { "startInfo":
{ "ReleaseKey": "5b754c63-5d1a-4c37-bb9b-74b69e4934bf",
"Strategy": "Specific",
"RobotIds": [ 1553 ],
"NoOfRobots": 0,
"Source": "Manual",
"InputArguments": "{\"message\":\"Aloha\"}"
}
}
"InputArguments": {"add_name": "xxxxx-xxx-"}
"InputArguments": "{\"add_name\": \"xxxxx-xxx-\"}"
\"InputArguments\": \"{\\\"add_name\\\": \\\"xxxxx-xxx-\\\"}\"
|
An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartArray' node was expected
Date : March 29 2020, 07:55 AM
This might help you I have an Azure AD Application where I need to add an extra appRole in the appRoles section within the service principal with Powershell. I use an Invoke-RestMethod to the Graph API with the following API Url: https://graph.microsoft.com/beta/servicePrincipals/AppID$input = @"
{
"allowedMemberTypes": [
"User"
],
"description": "TEST-ALLOWALL",
"displayName": "TEST-ALLOWALL",
"id": "00000000-0000-0000-0000-00000000",
"isEnabled": true,
"origin": "ServicePrincipal",
"value": "ARNROLEVALUE"
}
"@
$jObject = $input | convertfrom-json
$psObj = [Pscustomobject] @{
AllowedMemberTypes = $jObject.allowedMemberTypes
}
$psObj.AllowedMemberTypes.Gettype()
|
why 'PrimitiveValue' or 'StartObject' node was expected error
Date : March 29 2020, 07:55 AM
wish helps you Multi-select choice field value needs to set with a collection, here is a code snippet for your reference: <script type="text/javascript">
var locations = ['Locations1','Locations3'];
var Auditors = ['Auditor1','Auditor3'];
var item = {
"__metadata": {
"type": 'SP.Data.MyListListItem'
},
"Title":'Test',
"Locations": { '__metadata': { 'type' : 'Collection(Edm.String)'}, results: locations },
"Auditor": { '__metadata': { 'type' : 'Collection(Edm.String)'}, results: Auditors }
};
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('MyList')/items",
method: "POST",
contentType: "application/json;odata=verbose",
data: JSON.stringify(item),
async: false,
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function(data) {
alert('The Request has been successfully Added');
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR.responseText);
alert('Error');
}
});
</script>
|