logo
down
shadow

An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected


An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected

Content Index :

An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected
Tag : javascript , By : Nickolas
Date : January 11 2021, 05:14 PM

I wish this help you The error should be json data format.
My test script based on your demo(Email people field allow multiple selections).
<script type="text/javascript">
        function setPeoplesColumn() {
            console.log("user id is " + _spPageContextInfo.userId);
            var item =
            {
                "__metadata":
                {
                    "type": 'SP.Data.Address_x0020_BookListItem'
                },
                "Title": 'Some Dude',
                'EmailId':
                {
                    "results": [_spPageContextInfo.userId]
                }
            };
            $.ajax
                ({
                    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('Address Book')/items",
                    type: "POST",
                    headers:
                    {
                        "Accept": "application/json;odata=verbose",
                        "Content-Type": "application/json;odata=verbose",
                        "X-RequestDigest": $("#__REQUESTDIGEST").val()
                    },
                    data: JSON.stringify(item),
                    success: function (data) {
                        console.log("success is " + (data.d));
                        console.log("ID is " + JSON.stringify(data.d));
                    },
                    error: function (error) {
                        console.log("failure is " + JSON.stringify(error));
                    }
                });//end of ajax function
        }
    </script>

    <input id="Button1" type="button" onclick="setPeoplesColumn()" value="button" />

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

How to resolve error: An unexpected 'StartArray' node was found when reading from the JSON reader. A 'StartObject' node


Tag : javascript , By : Debashree
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


Tag : chash , By : phil
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


Tag : powershell , By : Arnaud Goudsmit
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


Tag : jquery , By : Mistere
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>
Related Posts Related QUESTIONS :
  • localStorage value doesn't get updated automatically
  • React not updating state with setState correctly inside promises
  • Direct native JavaScript or jQuery method to get containing block of an element
  • Dynamic JSON object to Html Table
  • How to send Id and file to same controller?
  • How to Make a jQuery Table Cell(td) clickable to Run a Function?
  • Prevent the duplicate function onchange event jQuery
  • Reactjs Input Upload doesn't return local URL
  • How to filter a JSON Array, with an eventListener input value at keyup
  • How to separate the different properties of filter in css?
  • Why dont work change event of bootstrap input spinner?
  • How to hide overflow text content in react
  • Is there another way to write line 6
  • Cypress - how to find by text content?
  • How to setstate for the dynamic checkboxes in a loop in react?
  • Is display:none safe?
  • How to create a form to change part of a href url of a button?
  • Put many function inside function in Javascript
  • how to exit from loop after a ajax call
  • Do Angular Reactive Form Validator.min/max check Perform Type Conversions before checking the value?
  • How to Replace Text Within Script Tags Using JQuery
  • add variable to object if not undefined using short-hand
  • How can I effectively curve my items inside a list?
  • Add new record Keyboard Shortcut on Kendo Grid Mvc
  • Time and Date running on page
  • Looping through page links puppeteer doesn't return values from the newly loaded page
  • Problem with Navigator.geoLocation.getCurrentPosition not working
  • Trying to change the id of an element with Javascript
  • Embedded Schema Inserting Blank in Meteor using Collection2
  • avoid useEffect to render at first load?
  • Why is this CSS transition only working correctly on the some clicks? How to solve it?
  • Interpolated values does not reflect the latest values in an Angular app
  • Javascript classes define attribute in constructor or outside the class
  • How to block scroll event passing through to iframe until iframe is active?
  • What is the purpose of "constructor" method in javascript?
  • Stencil JS not working with non-default imports
  • Are frameworks misleadingly named for marketing purposes?
  • React <Redirect> after transition not working
  • How to send multiple parameters in a function using EJS
  • React conditional style on custom click
  • Push a block of information to an array X times based on an external variable
  • How do I populate dropdown with names, and values (numeric ids)?
  • How to apply styling to elements created with .insertAdjacentHtml method
  • Positioning key:value of an object
  • Referencing DOM Elements with React Hooks
  • TypeError: Method "getRange" of null when using multiple scripts (Libraries) in Google scripts
  • Why can't I check if an environment variable is undefined?
  • Is there a way to find what parts are the same between two strings?
  • Every change done with magicscroll and greensock get reset when I hit the bottom of the page
  • Fix a 'Cannot read property handleClick of undefined error' (and issues related to deleting an item from the DOM)
  • Answer to message if sent within a period of time
  • Enabling a button based on selected values
  • Get All possible matches between forward slashes
  • get the CSS maxWidth value of the parent javascript
  • Async function returning existing array as undefined
  • Using drop-down list to change multiple values in separate table cells
  • How to remove nested empty objects in JavaScript?
  • Convert value from text field to paragraph
  • Sorting a list based on instructions in Javascript
  • Post request doesn't work in NodeJS, OK with Request
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com