question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No JSON object could be decoded

See original GitHub issue

Rasa NLU version : latest version

Used backend : mitie Plattform : Ubuntu-14.04

Issue: I have tried to train on a file generated using rasa-nlu-trainer, but i am getting below error .

Full stack trace : Traceback (most recent call last): File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "build/bdist.linux-x86_64/egg/rasa_nlu/train.py", line 72, in <module> File "build/bdist.linux-x86_64/egg/rasa_nlu/train.py", line 64, in do_train File "build/bdist.linux-x86_64/egg/rasa_nlu/training_data.py", line 35, in __init__ File "build/bdist.linux-x86_64/egg/rasa_nlu/training_data.py", line 78, in guess_format File "/usr/lib64/python2.7/json/__init__.py", line 339, in loads return _default_decoder.decode(s) File "/usr/lib64/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib64/python2.7/json/decoder.py", line 382, in raw_decode raise ValueError("No JSON object could be decoded")

I have validated using json validator it is correct json file. we have attached config.json for mitie and also tried with mitie_sklearn getting same issue.

Attachments Data file : rasa.json.zip Config file : config.json.zip

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
2fat2kidnapcommented, Mar 8, 2017

Well, this was entertaining, I learned of a new UNIX utility, today: iconv

TL;DR iconv -c -f UTF8 -t ASCII original.json > originalEncoded.json fixes the issue.

Somewhat more detailed, but very hypothetical, explanation: Looks like Chrome browser (at least, I’m assuming it’s tied to Chrome given that it was hard to reproduce) pushes for UTF-8 encoding when downloading files. On the other hand, it looks like rasa_nlu.train expects ASCII encoded files. Using: iconv -c -f UTF8 -t ASCII original.json > originalEncoded.json
converts the downloaded file to ASCII-readable encoding, allowing Python2.7 to play nicely with it. Don’t forget the -c flag, or you’ll get a iconv: could not convert error (at least, I did).

If you’re not sure you have the right encodings installed on your machine (you should though, this stuff is default), just issue iconv -l, it’ll list all the encodings.

0reactions
tmbocommented, Mar 8, 2017

Thanks for your help. The issue is with the BOM (which actually should be avoided for json files, I am not sure why chrome puts them there, might need to have a look at the download code).

Long story short, I fixed to code to cope with files having BOMs. 60e2625

Read more comments on GitHub >

github_iconTop Results From Across the Web

Displaying better error message than "No JSON object could ...
ValueError : No JSON object could be decoded. which is not very descriptive. The same operation with simplejson : simplejson.loads('[1,2,]') ...
Read more >
5/5 [resolved] 'No JSON Object could be decoded'
Here is my code: from urllib2 import urlopen from json import load apiUrl ... 5/5 [resolved] 'No JSON Object could be decoded'. Here...
Read more >
REST API Integration: No JSON object could be decoded
Hi, I tried do some integration towards serviceNow using python script and referring example given in this link to update the records: Table ......
Read more >
“ValueError No JSON object could be decoded" when running ...
The bootstrap script requires a valid hostname and port number to generate a new login user. Solution. Make sure that the correct hostname...
Read more >
no JSON object could be decoded - "MODULE FAILURE"
Hi: Trying to create VPN via play book results in the error as below. I also noticed that the api doesnot have all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found