Getting issue while converting Json to Datatable-->Unexpected JSON token when reading DataTable: StartObject. Path '[0].TxnInfo', line 8, position 16

Getting issue while converting Json to Datatable–>Unexpected JSON token when reading DataTable: StartObject. Path ‘[0].TxnInfo’, line 8, position 16.

Used this piece of code to convert to datatable but getting above error. Please help to sort this issue.

Newtonsoft.Json.JsonConvert.DeserializeObject(of Datable)(strAlertsArray)

Hello @Thiru_Malai

  1. Assign activity:

    • InputJson = “your JSON string here”
    • DataTableVariable = New DataTable()
  2. Deserialize JSON activity:

    • Input: InputJson
    • Output: JsonDeserialized (type: JArray)
  3. If activity (check if deserialization is successful):

    • Condition: JsonDeserialized IsNot Nothing

    a. Assign activity (convert JArray to DataTable):

    • DataTableVariable = JsonDeserialized.CopyToDataTable()

    b. Log Message activity:

    • Message: “JSON successfully converted to DataTable”

    c. (Optional) Add further logic to work with DataTableVariable as needed.

  4. Else activity (handle deserialization failure):

    • Log Message activity:
      • Message: “Failed to deserialize JSON”
  5. (Optional) Write Line activity:

    • Text: DataTableVariable.Rows.Count.ToString() // Display the number of rows in the DataTable

Thanks & Cheers!!!

Hi @Kartheek_Battu Again we facing same issue and we cant able to convert it into Data table.