Value Error: No JSON object could be decoded

Hello,

I need to create custom rest APIs in new .py file . It used to work fine is version 7.

But when same used in Latest production VM. It’s giving below error.

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 59, in application
    init_request(request)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 119, in init_request
    make_form_dict(request)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 127, in make_form_dict
    args = json.loads(request.data)
  File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Probably the input json is invalid, please validate it https://jsonlint.com/

Can you provide your inputs to api?

Please check the screenshots(merged)

Just tested with a simple GET function

Input should be in json format,
I think you need to select json input in Postman (Body->raw->json (from dropdown))

{"a":"Test"}

Thanks, But getting same issue if the function is without parameters.

Is there any issue with app.py of this VM?

Because the older version worked fine with all scenarios.

sorry not sure, I don’t use VM, may be others will reply…

The same problem here Error on Frappe API call (Value Error: No JSON object could be decoded)