Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

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

Posted on by 10
Hello good day.

I have a problem when registering several lines to a central Business entity (General Ledger)

8004.png

this is the body of the json object
6355.PNG

but when I register only 1 line if it works well, the problem is when registering several lines, I am creating the service in this way.

0435.PNG

or how could I do to be able to register more than 1 line (5000 lines) in a single call
Categories:
  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: An unexpected 'StartArray' node was found when reading from the JSON reader. A 'StartObject' node was expected

    Angel CR 

    I added some code to git hub:

    https://github.com/ingebruvik/JsonToGLJournal

    This adds an action to your G/L Journal page and you can upload the json file into your journal.

    Then we can build from here and add the support for the Azure blog store.

    You can see if you are able to access the code on github.

  • Angel CR Profile Picture
    Angel CR 10 on at
    RE: An unexpected 'StartArray' node was found when reading from the JSON reader. A 'StartObject' node was expected

    this is the file

    [

      {

         "DIARIO_ORIGEN":"GENERAL",

         "DIARIO_LOTE":"GL-PL",

         "FECHA_CONTABILIZACION":"2022-03-04",

         "FECHA_EMISION":"2022-03-04",

         "Linea":1,

         "CUENTA_TIPO":"G/L Account",

         "CUENTA_NUMERO":"6211110",

         "DESCRIPCION":"PLLA REM RESGUARDO ENE 2022",

         "MONEDA_ID":"PEN",

         "MONTO":0.0,

         "MONTO_ORIG":0.0,

         "DEBITO":28350.97,

         "CREDITO":0.0,

         "ESTRUCTURA_CUENTA":"A1-CCOSTO|B1-CLIENTE|B2-CORPORACION|A2-DEDUCIBLE|A3-PLACA|C2-PLANILLA|B3-TORRE|C1-TRABAJADOR||",

         "ESTRUCTURA_VALOR":"RSG01.CS01|20522228347|CORP. ISEG PERU S.A.|SÍ|||GENERAL|"

      },

      {

         "DIARIO_ORIGEN":"GENERAL",

         "DIARIO_LOTE":"GL-PL",

         "FECHA_CONTABILIZACION":"2022-03-04",

         "FECHA_EMISION":"2022-03-04",

         "Linea":2,

         "CUENTA_TIPO":"G/L Account",

         "CUENTA_NUMERO":"6211130",

         "DESCRIPCION":"PLLA REM RESGUARDO ENE 2022",

         "MONEDA_ID":"PEN",

         "MONTO":0.0,

         "MONTO_ORIG":0.0,

         "DEBITO":15246.92,

         "CREDITO":0.0,

         "ESTRUCTURA_CUENTA":"A1-CCOSTO|B1-CLIENTE|B2-CORPORACION|A2-DEDUCIBLE|A3-PLACA|C2-PLANILLA|B3-TORRE|C1-TRABAJADOR||",

         "ESTRUCTURA_VALOR":"RSG01.CS01|20522228347|CORP. ISEG PERU S.A.|SÍ|||GENERAL|"

      }

    ]

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: An unexpected 'StartArray' node was found when reading from the JSON reader. A 'StartObject' node was expected

    Yes i could do that if you could send a sample of your json file so i don't have to create those data myself.

    I can not copy it from an image :)

  • Angel CR Profile Picture
    Angel CR 10 on at
    RE: An unexpected 'StartArray' node was found when reading from the JSON reader. A 'StartObject' node was expected

    thank you, but could you share an example to guide me please

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: An unexpected 'StartArray' node was found when reading from the JSON reader. A 'StartObject' node was expected

    Ahh, sorry i did not catch that you do this in an API page.

    Then you will have to send one line at the time.

    If you have a large amount of lines then you should do this another way.

    Either create a customized API that can take the full json load and handle it as a batch or store the json in an Azure blob storage and have BC read it from there.

    When i need to handle a large batch of lines i save the Json to Azure blob storage first.

  • Angel CR Profile Picture
    Angel CR 10 on at
    RE: An unexpected 'StartArray' node was found when reading from the JSON reader. A 'StartObject' node was expected

    Hello, good morning, in the last image you can see that it is inside a matrix, perhaps the service that has been created in Business Central does not support when multiple lines are sent?

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: An unexpected 'StartArray' node was found when reading from the JSON reader. A 'StartObject' node was expected

    Are you sure your json is formatted correctly ?

    Should not the lines be in an array ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans