I had a similar issue to the line_items":"expected Hash to be a Array" and the issue was that my line_item array skipped a digit.
Ex:
line_item -> array[0]
line_item ->array[1]
line_item ->array[3]
Once I fixed it the loop that was generating the wrong counter, it properly uploaded.
Cheers