I'm trying to have this discord bot working and it's giving an error
Expecting 'EOF', '}', ',', ']', got ':'
I don't understand what the issue is with this JSON. I have attached the entire JSON below
"version": "1.0.0",
"description": "WordleEdit is a multiplayer version of Wordle (created by Josh Wardle) where players can edit their own words as they go. It runs as a Discord bot! I programmed the bot in February 2022 and played it with friends in March 2022, but for some reason I never released the source code until now. Well, here it is!",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository" {
"type": "git",
"url": "git+https://github.com/carykh/WordleEdit.git"
}
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/carykh/WordleEdit/issues"
},
"homepage": "https://github.com/carykh/WordleEdit#readme",
"dependencies": {
"discord.js": "^14.6.0"
}
}
}
Check your json with https://jsonlint.com/, becasue your json isn't in a correct format
Following maybe helpful
{
"version": "1.0.0",
"description": "WordleEdit is a multiplayer version of Wordle (created by Josh Wardle) where players can edit their own words as they go. It runs as a Discord bot! I programmed the bot in February 2022 and played it with friends in March 2022, but for some reason I never released the source code until now. Well, here it is!",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/carykh/WordleEdit.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/carykh/WordleEdit/issues"
},
"homepage": "https://github.com/carykh/WordleEdit#readme",
"dependencies": {
"discord.js": "^14.6.0"
}
}
Related
{
"name": "deployingdemo",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
error-> "start": "node app.js",
},
"author": "",
"license": "ISC",
"dependencies": {
"ejs": "^6.11.3",
"express": "^10.16.3"
}
}
remote: -----> Node.js app detected
remote: parse error: Expected separator between values at line 8, column 8
remote: ! Unable to parse package.json
Validate your JSON here:
https://jsonformatter.curiousconcept.com/
{
"name": "deployingdemo",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"ejs": "^6.11.3",
"express": "^10.16.3"
}
}
When removing the , after "start": "node app.js" I'm not getting any error or info messages.
In case Heroku gets confused you can try: Replacing \" with ' or just remove the test line.
I have a list of dictionaries (basically JSON Response of an endpoint)
I would need to Parse this 16000 lines of json objects and fitler the documents/objects which match criteria that
whose leaf element/field : statusInfo/status in not "UP" and of those filtered objects, just return "name" , "serviceUrl","status"
example :
"ADMIN-V1" "http://aws-ec2.aws.com:4435" "Warning"
I have been researching about JSONPath module , but there is no good documentation about it, and I could not find any easier way.
Any guidance is highly appreciated.
here is a snippet from long 16000 lines of JSON response.
[
{
"id": "9c108ec5",
"name": "USER-V2",
"managementUrl": "http://aws-ec2.aws.com:5784/",
"healthUrl": "http://aws-ec2.aws.com:5784/health",
"serviceUrl": "http://aws-ec2.aws.com:5784/",
"statusInfo": {
"status": "UP",
"timestamp": 1566663146681,
"details": {
"description": " Eureka Discovery Client",
"status": "UP"
}
},
"source": "discovery",
"metadata": {},
"info": {
"component": "user",
"description": "User REST Resource",
"version": "2.2.1",
"git": {
"commit": {
"time": "07/27/2018 # 15:06:55 CDT",
"id": "b2a1b37"
},
"branch": "refs/tags/v2.2.1"
}
}
},
{
"id": "1a381f20",
"name": "ADMIN-V1",
"managementUrl": "http://aws-ec2.aws.com:4435/",
"healthUrl": "http://aws-ec2.aws.com:4435/health",
"serviceUrl": "http://aws-ec2.aws.com:4435/",
"statusInfo": {
"status": "Warning",
"timestamp": 1566663146682,
"details": {
"description": "Spring Cloud Eureka Discovery Client",
"status": "Warning"
}
},
"source": "discovery",
"metadata": {},
"info": {
"description": "Exchange Admin REST Resource",
"api": {
"version": "1.2.1",
"name": "admin",
"link": "https://app.swaggerhub.com/apis/AWSExchange/admin/1.2.1"
},
"implementation": "admin",
"version": "1.1.0",
"git": {
"commit": {
"time": "01/04/2019 # 15:36:48 UTC",
"id": "39d5551"
},
"branch": "refs/tags/v1.1.0"
}
}
}
]
If your json file contains one big array, you'll want to stream that file in truncating out the array. Then use fromstream/1 to rebuild the objects and filtering them out as you go.
I don't have a representative file to test out the performance myself, but give this a try:
$ jq --stream -n 'fromstream(1|truncate_stream(inputs))
| select(.statusInfo.status != "UP")
| .name, .serviceUrl, .statusInfo.status
' input.json
I have a functioning webhook to a Teams channel to which I can successfully post messages. I am now trying to post an adaptive card to the webhook. Using Postman and performing a Post to https://outlook.office.com/webhook/xyz, with Content-Type set to application/json in the header and the following adaptive card set in the body.
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"speak": "Nothing to say.",
"body": [
{
"type": "TextBlock",
"text": "Hello Teams' user"
}
]
}
With this I receive a HTTP 400 Bad Request and Summary or Text is required message. Does anyone know if Teams webhooks support Adaptive Cards yet or if this is an unsupported task currently?
The answer below is now deprecated. Please refer to this answer and this answer.
Webhooks do not yet support Adaptive Cards! We plan to add support for Adaptive Cards shortly after we release them for bots.
I'm using axios to send an Adaptive Card to a Teams Connector and I was getting this same error. In my case, I was able to resolve the issue by wrapping the card as an "attachment" to the message protocol shown in this link (syntax copied here for reference).
https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using?tabs=cURL#send-adaptive-cards-using-an-incoming-webhook
{
"type":"message",
"attachments":[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content":{
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"type":"AdaptiveCard",
"version":"1.4",
"body":[
{
"type": "TextBlock",
"text": "For Samples and Templates, see [https://adaptivecards.io/samples](https://adaptivecards.io/samples)"
}
]
}
}
]
}
By sending the above JSON as the request body (data argument for axios), I successfully got the Adaptive Card to show up in my Teams Channel.
As you can see, the value of "content" is the Adaptive Card structure. The Adaptive Card follows the documented syntax, found here:
https://learn.microsoft.com/en-us/adaptive-cards/authoring-cards/getting-started
https://learn.microsoft.com/en-us/answers/questions/400502/adaptive-cards-with-incoming-webhooks-in-microsoft.html
But ultimately, I found it easier to work with this "Designer" https://www.adaptivecards.io/designer/
which provides a WYSIWYG interface.
I am sending the request to a Connector that I created in Teams by following the instructions found here:
https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook#create-incoming-webhook-1
And now it responds with 200 OK and shows up in the Channel!
For simple use cases POST this to the webhook url:
{
"title": "Action News",
"text": "not **much** happend (markdown)"
}
For advanced use cases try using MessageCard: https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using
Example:
{
"#type": "MessageCard",
"#context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "Larry Bryant created a new task",
"sections": [{
"activityTitle": "![TestImage](https://47a92947.ngrok.io/Content/Images/default.png)Larry Bryant created a new task",
"activitySubtitle": "On Project Tango",
"activityImage": "https://teamsnodesample.azurewebsites.net/static/img/image5.png",
"facts": [{
"name": "Assigned to",
"value": "Unassigned"
}, {
"name": "Due date",
"value": "Mon May 01 2017 17:07:18 GMT-0700 (Pacific Daylight Time)"
}, {
"name": "Status",
"value": "Not started"
}],
"markdown": true
}],
"potentialAction": [{
"#type": "ActionCard",
"name": "Add a comment",
"inputs": [{
"#type": "TextInput",
"id": "comment",
"isMultiline": false,
"title": "Add a comment here for this task"
}],
"actions": [{
"#type": "HttpPOST",
"name": "Add comment",
"target": "http://..."
}]
}, {
"#type": "ActionCard",
"name": "Set due date",
"inputs": [{
"#type": "DateInput",
"id": "dueDate",
"title": "Enter a due date for this task"
}],
"actions": [{
"#type": "HttpPOST",
"name": "Save",
"target": "http://..."
}]
}, {
"#type": "ActionCard",
"name": "Change status",
"inputs": [{
"#type": "MultichoiceInput",
"id": "list",
"title": "Select a status",
"isMultiSelect": "false",
"choices": [{
"display": "In Progress",
"value": "1"
}, {
"display": "Active",
"value": "2"
}, {
"display": "Closed",
"value": "3"
}]
}],
"actions": [{
"#type": "HttpPOST",
"name": "Save",
"target": "http://..."
}]
}]
}
You can actually send your adaptive card body inside the body array of this structure:
{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": null,
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.4",
"body": [
]
}
}
]
}
Reference: Microsoft
Recently I was facing the same issue and was looking for a solution. The good part is MS Teams support adaptive cards now
youtube video to explain how it can be implemented
Github link to track the progress on the issue
I managed to send messages to the Teams channel without any failure.
I keep receiving this error message when I open Atom. i have tried looking into it but I can't seem to find where the error message is? Am I missing out something in the JSON file?
Error message title
Failed to load the my-package package
untitled1:1
LFUTF-8Plain Text
Failed to load the my-package package
Unexpected token } in JSON at position 160 in /Users/tech-a48/.atom/packages/my-package/package.json
Hide Stack Trace
SyntaxError: Unexpected token } in JSON at position 160
at Object.parse (native)
at parseObject (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/lib/cson.js:54:19)
at parseContentsSync (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/lib/cson.js:68:16)
at Object.readFileSync (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/lib/cson.js:170:14)
at PackageManager.module.exports.PackageManager.loadPackageMetadata (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:721:29)
at PackageManager.module.exports.PackageManager.loadPackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:434:35)
at /Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:412:19
at Config.module.exports.Config.transact (/Applications/Atom.app/Contents/Resources/app.asar/src/config.js:312:16)
at PackageManager.module.exports.PackageManager.loadPackages (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:407:19)
at /Applications/Atom.app/Contents/Resources/app.asar/src/atom-environment.js:811:28
at /Users/tech-a48/.atom/packages/my-package/package.json:1:1
This is the JSON file. Am I completely blind or am I missing something?
{
"name": "my-package",
"main": "./lib/my-package",
"version": "0.0.0",
"description": "A short description of your package",
"keywords": [
],
},
{
"repository": "https://github.com/atom/my-package",
"license": "MIT",
"engines": {
"atom": ">=1.0.0 <2.0.0"
},
"dependencies": {
}
}
Hi guy the problem is because the structure of JSON file is wrong.
Try it this.
{
"name": "my_package",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo"
},
"keywords": [],
"author": "ag_dubs",
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/someone/my_package.git"
},
"bugs": {
"url": "https://github.com/someone/my_package/issues"
},
"homepage": "https://github.com/someone/my_package"
}
This is going to be very difficult for us to troubleshoot, because your objects structure is incorrect. Here is a valid json object. (this may not be correct)
{
"name": "my-package",
"main": "./lib/my-package",
"version": "0.0.0",
"description": "A short description of your package",
"keywords": [],
"repository": "https://github.com/atom/my-package",
"license": "MIT",
"engines": {
"atom": ">=1.0.0 <2.0.0"
},
"dependencies": {}
}
Your code is showing incomplete json to begin with so I'm going to assume you mean to add { at the top. An object must be reproducable. The json you provided is not reproducable as shown below.
{
{
"name": "my-package",
"main": "./lib/my-package",
"version": "0.0.0",
"description": "A short description of your package",
"keywords": [
],
}, //this indicates you are ending the object that has the "name" property
//but then look below, now your next object doesn't start with a name property.
//If you truly want separate objects. You should name each of them, so they are properties of the parent.
{
"repository": "https://github.com/atom/my-package",
"license": "MIT",
"engines": {
"atom": ">=1.0.0 <2.0.0"
},
"dependencies": {
}
}
Try this, it may help:
{
"name": "my-package",
"main": "./lib/my-package",
"version": "0.0.0",
"description": "A short description of your package",
"keywords": []
},
{
"repository": "https://github.com/atom/my-package",
"license": "MIT",
"engines":
{
"atom": ">=1.0.0 <2.0.0"
}
},
{
"dependencies": {}
}
For me not a single json string worked with the swagger editor.
Here is an example which i took from the page:
{
"swaggerVersion": "2.0",
"basePath": "http://localhost:8000/greetings",
"apis": [
{
"path": "/hello/{subject}",
"operations": [
{
"method": "GET",
"summary": "Greet our subject with hello!",
"type": "string",
"nickname": "helloSubject",
"parameters": [
{
"name": "subject",
"description": "The subject to be greeted.",
"required": true,
"type": "string",
"paramType": "path"
}
]
}
]
}
],
"models": {}
}
So current error for this, is:
✖ YAML Syntax Error
Missed comma between flow collection entries at line 2, column 14: "swagger: "2.0", ^
I don't know where did you take the base code for but that syntax seems to be totally wrong (at least for swagger 2), I recommend you to take a look to the official specification.
About the code you pasted, I refactorized it, try with this one:
{
"swagger": "2.0",
"host": "localhost:8000",
"basePath": "/greetings",
"info": {
"title": "Some title",
"version": "0.0.1"
},
"paths": {
"/hello/{subject}": {
"get": {
"summary": "Greet our subject with hello!",
"parameters": [{
"name": "subject",
"description": "The subject to be greeted.",
"required": true,
"type": "string",
"in": "path"
}],
"responses": {
"default": {
"description": "Some description",
"schema": {
"type": "string"
}
}
}
}
}
}
}
Even though the OP's syntax was wrong, this is for other people who are searching for an answer and their syntax is correct.
If you are getting the JSON data from the browser and you have a browser extension that formats and displays nicely the JSON data, it might cause trouble (because of the formatting) when pasting in Swagger Editor.
If that's the case, try disabling the extension or go incognito.