Deserialization Json Problem

Hi all,

I’m unable to extract the values from the below Json format, when i used Deserialize JSON it is throwing an error as Deserialize JSON: Deserialized JSON type ‘Newtonsoft.Json.Linq.JValue’ is not compatible with expected type ‘Newtonsoft.Json.Linq.JObject’. Path ‘’, line 1, position 6560.

Below is the format :“[{"Client Document Id":29,"Xtg Document Id":313892,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/29_1663140779177_1663136337342_1594207044684.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":30,"Xtg Document Id":313893,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/30_1663140779325_1663136337343_1594207096093.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":31,"Xtg Document Id":313894,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/31_1663140779448_1663136337344_1594207151916.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":32,"Xtg Document Id":313895,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/32_1663140779574_1663136337345_1594207563570.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":33,"Xtg Document Id":313896,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/33_1663140779699_1663136337346_1594208202140.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":34,"Xtg Document Id":313897,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/34_1663140779884_1663136337349_1594208968144.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":35,"Xtg Document Id":313898,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/35_1663140780013_1663136337350_1594209105011.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":36,"Xtg Document Id":313899,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/36_1663140780130_1663136337352_1594209139345.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":37,"Xtg Document Id":313900,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/37_1663140780272_1663136337353_1594209177313.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":19,"Xtg Document Id":313853,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-13-2022/19_1663127041455_1663126923453_1594088726406.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":39,"Xtg Document Id":319268,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/39_1701414193580_1701414149324_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":40,"Xtg Document Id":319269,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/40_1701414336755_1701414222060_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":41,"Xtg Document Id":319270,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/41_1701414338913_1701414243720_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":42,"Xtg Document Id":319271,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/42_1701414340915_1701414257814_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":43,"Xtg Document Id":319272,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/43_1701414342716_1701414272078_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":44,"Xtg Document Id":319273,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/44_1701414344405_1701414287500_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":45,"Xtg Document Id":319274,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/45_1701414346269_1701414308426_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":46,"Xtg Document Id":319275,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/46_1701414348008_1701414322757_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":47,"Xtg Document Id":319276,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/47_1701414392913_1701414368666_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":48,"Xtg Document Id":319277,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/48_1701414395003_1701414380788_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":49,"Xtg Document Id":319292,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-04-2023/49_1701684654727_1701684552417_1640928816540_fa0219102682.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":50,"Xtg Document Id":319293,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-04-2023/50_1701684654789_1701684552418_1640928817686_fa0219301130.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":51,"Xtg Document Id":319294,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-04-2023/51_1701684654831_1701684552419_1640928823431_fa0219301129.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":52,"Xtg Document Id":319295,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-04-2023/52_1701684654873_1701684552419_1640928824829_fa0219607535.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":53,"Xtg Document Id":319296,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-04-2023/53_1701684654914_1701684552420_1640928826000_Invoice_GB_PAD_PREF_8402445517_20211230.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141}]”

we crosschecked your sample JSON with https://jsonlint.com/ and it is a valid JARRAY
so we use the Deserialize JSON Array Activity

HI @pkbandharam

Extract Values:

  • Inside the loop, use the Assign activity or other activities to extract values from each JObject. For example:
item("Client Document Id").ToString
item("Xtg Document Id").ToString
item("Absolute File Name").ToString

Make sure to replace item with the variable representing the current JObject in the loop.

Also have a look at this:
grafik
out: myJArray

Deserialize JSON Array: Error reading JArray from JsonReader. Current JsonReader item is not an array: String. Path ‘’, line 1, position 6560.

“[{"Client Document Id":29,"Xtg Document Id":313892,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/29_1663140779177_1663136337342_1594207044684.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":30,"Xtg Document Id":313893,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/30_1663140779325_1663136337343_1594207096093.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":31,"Xtg Document Id":313894,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/31_1663140779448_1663136337344_1594207151916.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":32,"Xtg Document Id":313895,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/32_1663140779574_1663136337345_1594207563570.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":33,"Xtg Document Id":313896,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/33_1663140779699_1663136337346_1594208202140.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":34,"Xtg Document Id":313897,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/34_1663140779884_1663136337349_1594208968144.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":35,"Xtg Document Id":313898,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/35_1663140780013_1663136337350_1594209105011.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":36,"Xtg Document Id":313899,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/36_1663140780130_1663136337352_1594209139345.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":37,"Xtg Document Id":313900,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-14-2022/37_1663140780272_1663136337353_1594209177313.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":19,"Xtg Document Id":313853,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/09-13-2022/19_1663127041455_1663126923453_1594088726406.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":39,"Xtg Document Id":319268,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/39_1701414193580_1701414149324_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":40,"Xtg Document Id":319269,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/40_1701414336755_1701414222060_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":41,"Xtg Document Id":319270,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/41_1701414338913_1701414243720_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":42,"Xtg Document Id":319271,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/42_1701414340915_1701414257814_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":43,"Xtg Document Id":319272,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/43_1701414342716_1701414272078_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":44,"Xtg Document Id":319273,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/44_1701414344405_1701414287500_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":45,"Xtg Document Id":319274,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/45_1701414346269_1701414308426_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":46,"Xtg Document Id":319275,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/46_1701414348008_1701414322757_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":47,"Xtg Document Id":319276,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/47_1701414392913_1701414368666_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":48,"Xtg Document Id":319277,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-01-2023/48_1701414395003_1701414380788_testdocument.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":49,"Xtg Document Id":319292,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-04-2023/49_1701684654727_1701684552417_1640928816540_fa0219102682.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":50,"Xtg Document Id":319293,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-04-2023/50_1701684654789_1701684552418_1640928817686_fa0219301130.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":51,"Xtg Document Id":319294,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-04-2023/51_1701684654831_1701684552419_1640928823431_fa0219301129.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":52,"Xtg Document Id":319295,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-04-2023/52_1701684654873_1701684552419_1640928824829_fa0219607535.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141},{"Client Document Id":53,"Xtg Document Id":319296,"Absolute File Name":"/mnt/xtdfiles/Dev/AON/docImages/Invoice/12-04-2023/53_1701684654914_1701684552420_1640928826000_Invoice_GB_PAD_PREF_8402445517_20211230.pdf","Client Instance Id":140,"Client Id":1400,"Instance Document Type":141}]”

was also Passing JSON LINT and is valid JSON representing a JArray (you can also do with above shared Link)

we can better help, when also can inspect on what was done in detail

As showcased above with first JSON sample we were able to process it

Hello @ppr ,
I have removed quotes in the starting, ending of the file(here input json is in the text file) then it is not throwing any error.

Thanks for your inputs!!

perfect so the topic can be closed by