the JSON object must be string, bytes or bytesarray not dict

I am getting the mentioned error when am trying to read JSON data from ORM, DB used is Postgres.
I am trying to access the JSON filed inside the table, the version used is 3.2.16
I upgraded from 3.0.6 to 3.2.16 and then got this issue.

Please help if any one of you encountered this issue before

Please provide the code for the view in which this error is occurring, along with the complete traceback of the error.

Note: When posting code (or tracebacks) here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code (or traceback), then another line of ```. This forces the forum software to keep your code properly formatted.

code

‘’’ queryset = CLASSNAME.objects.filter(record_type=record_type)‘’’

`# TypeError at /api/dcr/

the JSON object must be str, bytes or bytearray, not dict

Request Method: GET
Request URL: url
Django Version: 3.2.16
Exception Type: TypeError
Exception Value: the JSON object must be str, bytes or bytearray, not dict
Exception Location: /usr/local/lib/python3.8/json/init.py, line 341, in loads
Python Executable:
Python Version: 3.8.5
Python Path:
Server time: Tue, 19 Mar 2024 13:13:31 +0000

Side notes: The ``` must be the backtick - ` character and not the apostrophe - '. Also, the lines of ``` must be lines by themselves and not part of a line with other text. And, when posting an error message with traceback, we generally need to see the full message from the server - not the summarized message from the browser.

Also, when asked for a view, please post the complete view, without editing or trying to “obfuscate” any references. It’s too easy to make a mistake, which just creates confusion and lengthens the time needed to try and help you solve the issue.

But, from the information we can see for far,

The error message is rather clear and explicit here:

I’m guessing value you are supplying for record_type is a dict.

(I’m guessing because we do not have complete information available yet.)

Also see the docs at Making queries | Django documentation | Django

no, record_type is just a string value, there is filed called enrich_data in that class, so when I filter data or just even try to access ‘’’ queryset = CLASSNAME.objects.all()‘’ it will throw the same error.

I am trying to read all the values in the class and in that one is a JSON value. Hope you got my point.

No, I’m sorry I don’t.

Please post the complete view, the model involved, the complete error message with the traceback, and the value of any variable being used that isn’t otherwise specified from the information above.