End of file expected.json line 21 [closed] - json

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
Can someone correct my JSON code and tell me what I did wrong? When I try to use it, I get an error on line 21, and I don't know what to do.
This is my code:
{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"code-runner.runInTerminal": true,
"explorer.confirmDelete": false,
"editor.linkedEditing": true,
"liveServer.settings.donotVerifyTags": true,
"liveServer.settings.donotShowInfoMsg": true,
"files.autoSaveDelay": 1,
"files.autoSave": "afterDelay",
"liveServer.settings.CustomBrowser": "firefox",
"tabnine.experimentalAutoImports": true,
"workbench.iconTheme": "easy-icons",
"workbench.colorTheme": "Field Lights",
"workbench.editorAssociations": [
{
"viewType": "jupyter.notebook.ipynb",
"filenamePattern": "*.ipynb"
}
],
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
}
}
{
"actionButtons": {
"defaultColor": "white",
"reloadButton": "Reload",
"commands": [
{
"name" : "Build",
"color": "white",
"command": "idf.py build"
},
{
"name" : "Run",
"color": "white",
"command": "idf.py flash -p COM1 -b 921600 monitor"
}
]
},
}
Thank you in advance!

You have a comma at the second last bracket.
It seems like you have 2 JSON objects as parents in the same file. I'm pretty sure that a JSON file only can have one parent/root that is either an object or an array.
This means that you will need to have two files instead of one.
One containing the first JSON object:
{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"code-runner.runInTerminal": true,
"explorer.confirmDelete": false,
"editor.linkedEditing": true,
"liveServer.settings.donotVerifyTags": true,
"liveServer.settings.donotShowInfoMsg": true,
"files.autoSaveDelay": 1,
"files.autoSave": "afterDelay",
"liveServer.settings.CustomBrowser": "firefox",
"tabnine.experimentalAutoImports": true,
"workbench.iconTheme": "easy-icons",
"workbench.colorTheme": "Field Lights",
"workbench.editorAssociations": [
{
"viewType": "jupyter.notebook.ipynb",
"filenamePattern": "*.ipynb"
}
],
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
}
}
And another containing the second JSON object:
{
"actionButtons": {
"defaultColor": "white",
"reloadButton": "Reload",
"commands": [
{
"name" : "Build",
"color": "white",
"command": "idf.py build"
},
{
"name" : "Run",
"color": "white",
"command": "idf.py flash -p COM1 -b 921600 monitor"
}
]
}
}
You could also have it in the same file, but wrapped in another root/parent object, like this:
{
"object1": {
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"code-runner.runInTerminal": true,
"explorer.confirmDelete": false,
"editor.linkedEditing": true,
"liveServer.settings.donotVerifyTags": true,
"liveServer.settings.donotShowInfoMsg": true,
"files.autoSaveDelay": 1,
"files.autoSave": "afterDelay",
"liveServer.settings.CustomBrowser": "firefox",
"tabnine.experimentalAutoImports": true,
"workbench.iconTheme": "easy-icons",
"workbench.colorTheme": "Field Lights",
"workbench.editorAssociations": [
{
"viewType": "jupyter.notebook.ipynb",
"filenamePattern": "*.ipynb"
}
],
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
}
},
"object2": {
"actionButtons": {
"defaultColor": "white",
"reloadButton": "Reload",
"commands": [
{
"name" : "Build",
"color": "white",
"command": "idf.py build"
},
{
"name" : "Run",
"color": "white",
"command": "idf.py flash -p COM1 -b 921600 monitor"
}
]
}
}
}
Or do it as an array, like this:
[
{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"code-runner.runInTerminal": true,
"explorer.confirmDelete": false,
"editor.linkedEditing": true,
"liveServer.settings.donotVerifyTags": true,
"liveServer.settings.donotShowInfoMsg": true,
"files.autoSaveDelay": 1,
"files.autoSave": "afterDelay",
"liveServer.settings.CustomBrowser": "firefox",
"tabnine.experimentalAutoImports": true,
"workbench.iconTheme": "easy-icons",
"workbench.colorTheme": "Field Lights",
"workbench.editorAssociations": [
{
"viewType": "jupyter.notebook.ipynb",
"filenamePattern": "*.ipynb"
}
],
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
}
},
{
"actionButtons": {
"defaultColor": "white",
"reloadButton": "Reload",
"commands": [
{
"name" : "Build",
"color": "white",
"command": "idf.py build"
},
{
"name" : "Run",
"color": "white",
"command": "idf.py flash -p COM1 -b 921600 monitor"
}
]
}
}
]

Related

Problems with a prebuilt code for a skr-pro-v1.2

I did not create this code nor am i affiliated in any way. Bought a skr-pro-v1.2 for my cr10s by accident but I'm trying to make it work. Found this https://github.com/mommel/Skr-pro-CR10s-TCM2209-TFT while searching for anything related to flashing the board.
Followed the instructions from the github and opened the btt.cod-workspace in visual as well as installing the recommended extensions.
The code is as follows
{
"settings": {
"git.ignoreSubmodules": true,
"git.detectSubmodulesLimit": 15,
"update.mode": "none",
"platformio-ide.disablePIOHomeStartup": true,
"platformio-ide.activateOnlyOnPlatformIOProject": false,
"platformio-ide.autoPreloadEnvTasks": true,
"window.zoomLevel": 0.3,
"editor.detectIndentation": true,
"editor.insertSpaces": true,
"editor.tabSize": 2,
"explorer.openEditors.visible": 0,
"explorer.compactFolders": true,
"workbench.editor.enablePreviewFromQuickOpen": false,
"editor.minimap.renderCharacters": false,
"editor.minimap.maxColumn": 200,
"editor.minimap.showSlider": "always",
"workbench.editor.labelFormat": "short",
"workbench.editor.showIcons": false,
"window.title": "BTT Skr Pro v1.2 CR-10 ${dirty}",
"editor.renderWhitespace": "all",
"workbench.settings.enableNaturalLanguageSearch": false,
"editor.smoothScrolling": true,
"editor.cursorBlinking": "phase",
"editor.cursorSmoothCaretAnimation": true,
"files.autoSave": "onFocusChange",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
//"git.detectSubmodules": true,
//"task.autoDetect": "off",
"grunt.autoDetect": "off",
"jake.autoDetect": "off",
"gulp.autoDetect": "off",
"npm.autoDetect": "on",
//"platformio-ide.buildTask": null,
"workbench.iconTheme": "material-icon-theme",
"workbench.activityBar.visible": true,
"task.saveBeforeRun": "always",
"task.problemMatchers.neverPrompt": true,
"typescript.tsc.autoDetect": "off",
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true
}
},
"extensions": {
"recommendations": [
"platformio.platformio-ide",
"Tyriar.sort-lines"
],
"unwantedRecommendations": []
},
"folders": [
{
"name": "Generated Firmware",
"path": "dist"
},
{
"name": "Build",
"path": "build"
},
{
"name": "----------------------------------------------",
"uri": "/:2spacer"
},
{
"name": "Board Marlin Firmware",
"path": "Firmware/Board/Marlin/Marlin_2.0.x-bugfix"
},
{
"name": "Display BTT TouchScreen Firmware",
"path": "Firmware/Display/BIGTREETECH/TouchScreenFirmware"
},
{
"name": "WIFI ESP3D Firmware",
"path": "Firmware/Wifi_ESP-1s/ESP3D"
},
{
"name": "WIFI ESP3D WebUI",
"path": "Firmware/Wifi_ESP-1s/ESP3D-WEBUI"
},
{
"name": "----------------------------------------------",
"uri": "/:02"
},
{
"name": "Information - Board BTT SKR PRO v1.2",
"path": "Informations/Board/BIGTREETECH-SKR-PRO-V1.1"
},
{
"name": "Information - Marlin Configurations",
"path": "Firmware/Board/Marlin/Configurations_2.0x-bugfix"
},
{
"name": "Information - Display BTT Hardware",
"path": "Informations/Display/BIGTREETECH-TouchScreenHardware"
},
{
"name": "Information - Driver BTT TMC2209 v1.2",
"path": "Informations/Driver/BIGTREETECH-TMC2209-V1.2"
},
{
"name": "Information - Driver BTT TMC2209 Stepper-Driver Jumper Configuration Manual",
"path": "Informations/Driver/SKR-PRO-V1.2-Stepper-Driver-Jumper-Configuration-Manual"
},
{
"name": "Information - Relay BTT v1.2",
"path": "Informations/Relay/BTT-Relay-V1.2"
},
{
"name": "Display BTT TouchScreen Plugin Suit",
"path": "Software/Display/Addon/Bigtree3DPluginSuit"
}
]
}
It is the only relative code i can find that puts together specifically the cr10s, skr prov1.2, wifi module, and the 2209 drivers... the tft screen is not the same (BTT 3.5 inch 3.0) but i was hoping to find out how to change that later if a conflict happens...
When running with debugging i receive an error "You don't have an extension for debugging 'JSON with Comments" which i also found is normal from other links on this site...
tl;dr found this code to flash the board i bought which fits all my needs minus the tft screen... is there anyway to fix/bypass or rescript? to make it write the files i need for flashing..
New to coding please be gentle sorry if any rules are broken for any of the request/tags i thank everyone for their time.

Failed to get certain files from IPFS cluster

Because public IPFS gateway is too slow, I set up own ipfs cluster using kubernetes on AWS.
However, when I tried to get files from the cluster, I succeeded for some files but failed for others consistently(failed one kept failing).
How do I debug this? Did I make mistake on configuration? Here's the configuration I used.
{
"API": {
"HTTPHeaders": {
"Access-Control-Allow-Methods": [
"PUT",
"POST"
],
"Access-Control-Allow-Origin": [
"http://localhost:3000",
"http://127.0.0.1:5001",
"https://webui.ipfs.io"
]
}
},
"Addresses": {
"API": "/ip4/0.0.0.0/tcp/5001",
"Announce": [],
"AppendAnnounce": [],
"Gateway": "/ip4/0.0.0.0/tcp/8080",
"NoAnnounce": [],
"Swarm": [
"/ip4/0.0.0.0/tcp/4001",
"/ip6/::/tcp/4001",
"/ip4/0.0.0.0/udp/4001/quic",
"/ip6/::/udp/4001/quic"
]
},
"AutoNAT": {},
"Bootstrap": [
"/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
"/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
],
"DNS": {
"Resolvers": {}
},
"Datastore": {
"BloomFilterSize": 0,
"GCPeriod": "1h",
"HashOnRead": false,
"Spec": {
"mounts": [
{
"child": {
"path": "blocks",
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
"sync": true,
"type": "flatfs"
},
"mountpoint": "/blocks",
"prefix": "flatfs.datastore",
"type": "measure"
},
{
"child": {
"compression": "none",
"path": "datastore",
"type": "levelds"
},
"mountpoint": "/",
"prefix": "leveldb.datastore",
"type": "measure"
}
],
"type": "mount"
},
"StorageGCWatermark": 90,
"StorageMax": "10GB"
},
"Discovery": {
"MDNS": {
"Enabled": true,
"Interval": 10
}
},
"Experimental": {
"AcceleratedDHTClient": false,
"FilestoreEnabled": false,
"GraphsyncEnabled": false,
"Libp2pStreamMounting": false,
"P2pHttpProxy": false,
"StrategicProviding": false,
"UrlstoreEnabled": false
},
"Gateway": {
"APICommands": [],
"HTTPHeaders": {
"Access-Control-Allow-Headers": [
"X-Requested-With",
"Range",
"User-Agent"
],
"Access-Control-Allow-Methods": [
"GET"
],
"Access-Control-Allow-Origin": [
"*"
]
},
"NoDNSLink": false,
"NoFetch": false,
"PathPrefixes": [],
"PublicGateways": null,
"RootRedirect": "",
"Writable": false
},
"Identity": {
"PeerID": "<intentionally hide>"
},
"Internal": {},
"Ipns": {
"RecordLifetime": "",
"RepublishPeriod": "",
"ResolveCacheSize": 128
},
"Migration": {
"DownloadSources": [],
"Keep": ""
},
"Mounts": {
"FuseAllowOther": false,
"IPFS": "/ipfs",
"IPNS": "/ipns"
},
"Peering": {
"Peers": null
},
"Pinning": {
"RemoteServices": {}
},
"Plugins": {
"Plugins": null
},
"Provider": {
"Strategy": ""
},
"Pubsub": {
"DisableSigning": false,
"Router": ""
},
"Reprovider": {
"Interval": "12h",
"Strategy": "all"
},
"Routing": {
"Type": "dht"
},
"Swarm": {
"AddrFilters": null,
"ConnMgr": {
"GracePeriod": "20s",
"HighWater": 900,
"LowWater": 600,
"Type": "basic"
},
"DisableBandwidthMetrics": false,
"DisableNatPortMap": false,
"RelayClient": {
"Enabled": true
},
"RelayService": {
"Enabled": true
},
"Transports": {
"Multiplexers": {},
"Network": {},
"Security": {}
}
}
}

ESLint 'module' is not defined. (no-undef) into PhpStorm

In PhpStorm I have this error in my .eslintrc file :
ESLint 'module' is not defined. (no-undef) into PHPStorm
I already try to fix it using this StackOverflow question. But the result is the same. ESLint error appears again.
This is my .eslintrc file:
/* eslint-env node */
{
"root": false,
"parser": "#typescript-eslint/parser",
"plugins": [
"#typescript-eslint"
],
"env": {
"node": true,
"browser": true,
"commonjs": true,
"es6": true,
"amd": true
},
"extends": [
"eslint:recommended",
"plugin:vue/base",
"plugin:vue/essential",
"plugin:vue/vue3-recommended",
"plugin:vue/vue3-essential",
"#vue/typescript/recommended",
"plugin:#typescript-eslint/eslint-recommended",
"plugin:#typescript-eslint/recommended"
],
"parserOptions": {
"ecmaVersion": 2020
},
"rules": {
"no-console": "error",
"no-debugger": "error",
"no-unused-components": "off",
"no-unused-vars": "off",
"no-empty-function": "off",
"prefer-const": "off",
"#typescript-eslint/no-unused-vars": "off"
},
"overrides": [
{
"files": [
"**/__tests__/*.{j,t}s?(x)",
"**/tests/unit/**/*.spec.{j,t}s?(x)"
],
"env": {
"mocha": true
}
}
]
}
Perhaps it's a PhpStorm issue ?
How to resolve this error ESLint ?
delete 'es6': 'true',
just like:
"env": {
"node": true,
"browser": true,
"commonjs": true,
"amd": true
}

Json data is not populated in treeview panel

here below is my json formate i need to show in the treeview panel in extjs6
After loading store from server i am not able to see any records in Tree panel.
what should be the Model view and store for this json rendering in to the Tree view panel .
Thanks.
here is my code :
Model :
Ext.define('File', {
extend: 'Ext.data.TreeModel',
fields: [
{number: 'number', type: 'string'},
]
});
Store :
var store = Ext.create('Ext.data.TreeStore', {
model: 'File',
proxy: {
type: 'ajax',
url: 'component-tree.json',
reader: {
type: 'json',
rootProperty: 'components',
leaf: true,
children: 'components',
expanded: true,
},
},
folderSort: true,
});
View :
var tree = Ext.create('Ext.tree.Panel', {
autoLoad: true,
collapsible: true,
useArrows: true,
rootVisible: true,
store: store,
multiSelect: true,
width: 250,
height: 300,
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
appendOnly: true
}
},
root: {
text: "Components",
expanded: true,
},
renderTo: document.body
});
component-tree.json :
{
"components": {
"state": "RELEASED",
"nodeType": "Component",
"checked": true,
"name": "PLATE - FOR CABINET - ASSEMBLY",
"level": 0,
"url": "http://example.com/Windchill/servlet/nexiles/tools/api/1.0/epmdocuments/OR:wt.epm.EPMDocument:4474031",
"oid": "OR:wt.epm.EPMDocument:4474031",
"modified": "17.04.2015",
"filename": "21378386.asm",
"num_children": 7,
"number": "21378386.ASM",
"details": "http://example.com/Windchill/app/#ptc1/tcomp/infoPage?oid=OR:wt.epm.EPMDocument:4474031&u8=1",
"components": [
{
"nodeType": "Component",
"leaf": true,
"name": "PLATE - FOR CABINET - DETAIL",
"level": 1,
"url": "http://example.com/Windchill/servlet/nexiles/tools/api/1.0/epmdocuments/OR:wt.epm.EPMDocument:4474018",
"oid": "OR:wt.epm.EPMDocument:4474018",
"modified": "17.04.2011",
"filename": "1234.prt",
"state": "RELEASED",
"number": "21378385.PRT",
"details": "http://example.com/Windchill/app/#ptc1/tcomp/infoPage?oid=OR:wt.epm.EPMDocument:4474018&u8=1",
"version": "A",
"checked": true,
"drawings": [
{
"reftype": "DRAWING",
"nodeType": "Drawing",
"leaf": true,
"name": "PLATE - FOR CABINET - DETAIL",
"url": "http://example.com/Windchill/servlet/nexiles/tools/api/1.0/epmdocuments/OR:wt.epm.EPMDocument:4474013",
"oid": "OR:wt.epm.EPMDocument:4474013",
"modified": "17.04.2015",
"filename": "21378385.drw",
"source": "representation",
"state": "RELEASED",
"number": "21378385.DRW",
"details": "http://example.com/Windchill/app/#ptc1/tcomp/infoPage?oid=OR:wt.epm.EPMDocument:4474013&u8=1",
"version": "A",
"checked": true,
"id": "OR:wt.epm.EPMDocument:4474013-DRAWING",
"icon": "/resources/images/drawing.gif"
},
{
"reftype": "INTERNAL",
"nodeType": "Drawing",
"leaf": true,
"name": "PLATE - FOR CABINET - ASSEMBLY",
"url": "http://example.com/Windchill/servlet/nexiles/tools/api/1.0/epmdocuments/OR:wt.epm.EPMDocument:4474041",
"oid": "OR:wt.epm.EPMDocument:4474041",
"modified": "17.04.2015",
"filename": "21378386.drw",
"source": "representation",
"state": "RELEASED",
"number": "21378386.DRW",
"details": "http://example.com/Windchill/app/#ptc1/tcomp/infoPage?oid=OR:wt.epm.EPMDocument:4474041&u8=1",
"version": "A",
"checked": true,
"id": "OR:wt.epm.EPMDocument:4474041-INTERNAL",
"icon": "/resources/images/drawing.gif"
}
],
"icon": "/resources/images/prt_image.gif"
}
}
Your treeModel just defines number but your store actually contains much more fields...
Take a look at the doc in the chapter 'Heterogeneous node types' for more information.
Try with children instead of components in your json file. By the way I could remark that the case is not respected between the configuration root: { text: "Components", ... } and the json content "components": [ ... ].
C and c

ExtJS4 How to set TreePanels root node from JSON

I want to create TreePanel using ExtJS4. So I'm sending JSON to proxy reader which has following format
{
"text": "en",
"children": {
"text": "/",
"children": [{
"text": "/page",
"children": [{
"text": "/page/new",
"children": [],
"leaf": true,
"expanded": false
},
{
"text": "/page/remove",
"children": [],
"leaf": true,
"expanded": false
}
],
"leaf": false,
"expanded": false
},
{
"text": "/home",
"children": [],
"leaf": true,
"expanded": false
}
],
"leaf": false,
"expanded": true
}
}
How do I have to configure my Store if I want en node to be my root node.
Ext.define('Example.store.WebItems', {
extend: 'Ext.data.TreeStore',
model: 'Example.model.Item',
proxy: {
type: 'ajax',
api: {
read: 'some/url',
},
reader: {
type: 'json',
root: 'children' // Is this correct?
}
},
root: // What should I write here?
});
When I define TreeStore's root as root: 'My Root' it will add new root, but I want to use root defined in JSON.
So my questions are:
How to use root node from JSON instead of defining it manualy?
Do I have to define root node in proxy reader and TreeStore as well?
Response has to have root.
For example:
{
MyRoot: {
"text": "en",
"children": {
"text": "/",
"children": [{
"text": "/page",
"children": [{
"text": "/page/new",
"children": [],
"leaf": true,
"expanded": false
}, {
"text": "/page/remove",
"children": [],
"leaf": true,
"expanded": false
}],
"leaf": false,
"expanded": false
}, {
"text": "/home",
"children": [],
"leaf": true,
"expanded": false
}],
"leaf": false,
"expanded": true
}
}
}
In this example root is MyRoot. Now you have to "tell" reader that your root is MyRoot:
// ...
reader: {
type: 'json',
root: 'MyRoot'
}
},
//root: this config is not needed now
});
As per I know, you need to specify root as following:
root: {
text: 'en',
id: 'src',
expanded: true '
}
Try the above code snippet it will help you.
May be late but for others , wrap the JSON inside array [] just like this :
[{
"text": "en",
"children": {
"text": "/",
"children": [{
"text": "/page",
"children": [{
"text": "/page/new",
"children": [],
"leaf": true,
"expanded": false
}, {
"text": "/page/remove",
"children": [],
"leaf": true,
"expanded": false
}],
"leaf": false,
"expanded": false
}, {
"text": "/home",
"children": [],
"leaf": true,
"expanded": false
}],
"leaf": false,
"expanded": true
}
}]
Remove the reader block
reader: {
type: 'json',
root: 'MyRoot'
}
Add root block :
root: {
text: 'en',
id: 'src',
expanded: true '
}
Add rootVisible: false in treepanel.