Question Status

Suggested Answer
maram fraij asked a question on 17 May 2018 8:56 PM

I am working with ax data entity using Json.

I try to push a list of records to AX data base using Json array shown below  but the below error is faced 

 Json array:

[{"Key1":"Value1","Key2":Value } ,
{"Key1":"Value1","Key2":Value }]

Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray

the question is how to pass a Json array 

Reply
Suggested Answer
Martin Dráb responded on 18 May 2018 1:40 AM

Please make sure you give us enough information; now I'll have to make quite a few assumptions.

I assume you're talking about a custom service which accepts a single argument of type array. And I assume the JSON string above is what you're trying to send to the service.

If so, your message isn't correct. Instead of using an array directly, you should provide an object with one property (with the same name as the name of the method argument). The value of the property will be the array.

Reply
Suggested Answer
Martin Dráb responded on 18 May 2018 1:40 AM

Please make sure you give us enough information; now I'll have to make quite a few assumptions.

I assume you're talking about a custom service which accepts a single argument of type array. And I assume the JSON string above is what you're trying to send to the service.

If so, your message isn't correct. Instead of using an array directly, you should provide an object with one property (with the same name as the name of the method argument). The value of the property will be the array.

Reply