ValueError: Unknown data format for file "data\data.json"

I am using rasa 1.1.6 . When i am running my nlu_model.py file to train my nlu i am getting

ValueError: Unknown data format for file “data\data.json”

I have updated my data.json file in below format

{
    "rasa_nlu_data": {
        "common_examples": [],
        "regex_features" : [],
        "lookup_tables"  : [],
        "entity_synonyms": []
    }
}

But i am still getting the error. Below is my code

from rasa.nlu.training_data import load_data
from rasa.nlu import config
from rasa.nlu.model import Trainer
from rasa.nlu.model import Metadata, Interpreter


def train_nlu(data, configs, model_dir):
    training_data = load_data(data)
    trainer = Trainer(config.load(configs))
    trainer.train(training_data)
    model_directory = trainer.persist(model_dir, fixed_model_name='weathernlu')

if __name__=='__main__':
    train_nlu("C:\\Samples\\xxx\\data\\data.json","C:\\Samples\\xxx\\config_spacy.json","C:\\Samples\\xxx\\models\\nlu")

Below is my data.json file

{ “rasa_nlu_data”: { “common_examples”: [ { “intent”: “sendPin”, “entities”: [ { “start”: 5, “end”: 16, “value”: “fgrekjbgjgr”, “entity”: “pinname” }, { “start”: 30, “end”: 34, “value”: “mani”, “entity”: “person” } ], “text”: “send fgrekjbgjgr pin board to mani” }, { “intent”: “sendPin”, “entities”: [ { “start”: 8, “end”: 18, “value”: “svfkjgvnrb”, “entity”: “pinname” }, { “start”: 31, “end”: 35, “value”: “gopi”, “entity”: “person” } ], “text”: “forward svfkjgvnrb pinboard to gopi” }, { “intent”: “sendPin”, “entities”: [ { “start”: 6, “end”: 16, “value”: “refkregrek”, “entity”: “pinname” }, { “start”: 24, “end”: 30, “value”: “mahesh”, “entity”: “person” } ], “text”: “share refkregrek pin to mahesh” }, { “intent”: “sendPin”, “entities”: [ { “start”: 9, “end”: 14, “value”: “rewfr”, “entity”: “pinname” }, { “start”: 28, “end”: 34, “value”: “ganesh”, “entity”: “person” } ], “text”: “send the rewfr pin board to ganesh” } ], “regex_features”: [], “lookup_tables”: [], “entity_synonyms”: [] } }

Seems like you guys have the exact problem, you may find the answer here. You json format is wrong.

I tried this approach also but still i am getting same error. Even while executing convert nlu script i am getting the same error. I tried downgrading my rasa to 1.0.6 but still it is showing same error.

it seems like it’s the problem of “” and “”

you may always check your json file with a json validator …

or you can simply run the md file…

result.json (1.7 KB)

if this does not work still… I am not sure …

Thanks a lot for the help. As it turned out your findings were correct. So when i checked i found out that my data.json file was in utf-8 fromat which is causing problem so i changed the encoding to ANSI in notepad which worked out. Thanks a lot for your help as i was stuck in this issue for so long.

1 Like