jovotech / jovo-framework

🔈 The React for Voice and Chat: Build Apps for Alexa, Messenger, Instagram, the Web, and more
https://www.jovo.tech
Apache License 2.0
1.67k stars 310 forks source link

Model-File is not valid JSON: Unexpected string in JSON #547

Closed silas546 closed 5 years ago

silas546 commented 5 years ago

I'm submitting a...

Expected Behavior

Attempting to build my language model via Jovo build. I haven't made any recent changes to my en-US.json language model.

Current Behavior

    ❯ Initializing build process
      ✔ Collecting platform configuration from project.js
        Platforms: alexaSkill, googleAction
      ✔ Collecting Jovo Language Model files from /models folder
        Locales: en-US
      ❯ Validate Model-Files
        ✖ en-US
         -> Model-File is not valid JSON: Unexpected string in JSON at position 620
            while parsing '{    "invocation": "ochsner",    "intents": '

      Updating Alexa Skill project files (stage: local)
      Path: ./platforms/alexaSkill

      Updating Google Action project files (stage: local)
      Path: ./platforms/googleAction

Heres my language model:

{
    "invocation": "ochsner",
    "intents": [
        {
            "name": "OchGreetingIntent",
            "phrases": [
                "hello"
            ]
        },
        {
            "name": "HelpIntent",
            "phrases": [
                "help"
            ]
        }
    ],
    "alexa": {
        "interactionModel": {
            "languageModel": {
                "intents": [
                    {
                        "name": "AMAZON.CancelIntent",
                        "samples": []
                    },
                    {
                        "name": "AMAZON.HelpIntent",
                        "samples": []
                    },
                    {
                        "name": "AMAZON.StopIntent",
                        "samples": []
                    },
                    {
                        "name": "FindALocationIntent",
                        "samples": [
                            "After Hours Care",
                            "Urgent Care",
                            "Nearest urgent care"
                            "Where is the nearest urgent care",
                            "Find a Location"
                        ]
                    }
                ]
            }
        }
    },
    "dialogflow": {
        "intents": [
            {
            "name":"GoogleLocationIntent",
            "webhookUsed": true,
            "auto": true,
            "userSays": [
                {
                    "data": [
                        {
                            "text": "find a location",
                            "userDefined": false
                        }
                    ],
                    "isTemplate": false,
                    "count": 0
                },
                {
                    "data": [
                        {
                            "text": "urgent care",
                            "userDefined": false
                        }
                    ],
                    "isTemplate": false,
                    "count": 0
                }
            ]
        },
        {
            "name": "LocationDistanceIntent",
            "webhookUsed": true,
            "auto": true,
            "isTemplate": false,
            "count": 0
        },
            {
                "name": "Default Fallback Intent",
                "auto": true,
                "webhookUsed": true,
                "fallbackIntent": true
            },
            {
                "name": "Default Welcome Intent",
                "auto": true,
                "webhookUsed": true,
                "events": [
                    {
                        "name": "WELCOME"
                    }
                ]
            }
        ]
    }
}

Error log

If you have an error log, please paste it here.

Your Environment

aswetlow commented 5 years ago

Hey! There's a missing comma. Usually, that will be detected by your IDE. If not, here's an online JSON validator https://jsonformatter.curiousconcept.com/

This is the valid version:

{
    "invocation": "ochsner",
    "intents": [
        {
            "name": "OchGreetingIntent",
            "phrases": [
                "hello"
            ]
        },
        {
            "name": "HelpIntent",
            "phrases": [
                "help"
            ]
        }
    ],
    "alexa": {
        "interactionModel": {
            "languageModel": {
                "intents": [
                    {
                        "name": "AMAZON.CancelIntent",
                        "samples": []
                    },
                    {
                        "name": "AMAZON.HelpIntent",
                        "samples": []
                    },
                    {
                        "name": "AMAZON.StopIntent",
                        "samples": []
                    },
                    {
                        "name": "FindALocationIntent",
                        "samples": [
                            "After Hours Care",
                            "Urgent Care",
                            "Nearest urgent care",
                            "Where is the nearest urgent care",
                            "Find a Location"
                        ]
                    }
                ]
            }
        }
    },
    "dialogflow": {
        "intents": [
            {
            "name":"GoogleLocationIntent",
            "webhookUsed": true,
            "auto": true,
            "userSays": [
                {
                    "data": [
                        {
                            "text": "find a location",
                            "userDefined": false
                        }
                    ],
                    "isTemplate": false,
                    "count": 0
                },
                {
                    "data": [
                        {
                            "text": "urgent care",
                            "userDefined": false
                        }
                    ],
                    "isTemplate": false,
                    "count": 0
                }
            ]
        },
        {
            "name": "LocationDistanceIntent",
            "webhookUsed": true,
            "auto": true,
            "isTemplate": false,
            "count": 0
        },
            {
                "name": "Default Fallback Intent",
                "auto": true,
                "webhookUsed": true,
                "fallbackIntent": true
            },
            {
                "name": "Default Welcome Intent",
                "auto": true,
                "webhookUsed": true,
                "events": [
                    {
                        "name": "WELCOME"
                    }
                ]
            }
        ]
    }
}
silas546 commented 5 years ago

Oh my bad - I have no idea why my IDE didn't catch that. I just happened to first notice this issue after updating jovo-cli. Sorry! Closing this out