-1

I am getting below error while jsonify.

TypeError: '<' not supported between instances of 'numpy.ndarray' and 'str'

My code is:

if rows[0]:
        print("row1",rows[1])
        #data_json = str(rows[1])
        data_json = jsonify(rows[1])

Expecting Json object but getting error.

1 Answers1

0

jsonify only accepts dictionaries, lists, and primitive data types as input. Convert the numpy.ndarray to a list and then pass it to jsonify.

if rows[0]:
        print("row1",rows[1])
        data_json = jsonify(rows[1].tolist())
AboAmmar
  • 5,439
  • 2
  • 13
  • 24