Reputation: 435
I have this code in it now...with the entra line after the closing }...
Here is a larger screenshot of it now!
{
"menu" : {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{ "value" : "New", "onclick": "CreateNewDoc()" },
{ "value" : "Open", "onclick": "OpenDoc()" },
{ "value" : "Close", "onclick": "CloseDoc()" }
]
}
}
}
Upvotes: 8
Views: 9771
Reputation: 905
The answer provided by danielctw
here worked for me for the first time but not again. I believe the error might be due to hidden characters.
I solved this by copying the contents of the json file and pasting it into notepad(in windows) and then copying it from there and pasting it into the json file and the errors were gone.
I somewhere read about how some hidden characters are removed in a notepad file but I am not sure and if someone knows, please mention so that me and others can learn.
Upvotes: 0
Reputation: 1
I had the same problem. And thanks to the tips of using Ctrl+Shift+F to see the formatting of brackets ("{" and "["). I realized there are "extra" single side brackets (like open without closing) in the Ctrl+Shift+F mode. But when I undo it using Ctrl+Z, the extra brackets were gone. It seems like some escape-sequence control codes are in the file. And it being removed when using the above trick.
It is resolved now.
Upvotes: 0
Reputation: 83
It happened the same thing on my Eclipse Photon, and looking at some of the examples here and assistance, I tried to edit the file and save it. Errors still the same.
I did a simple trick which actually does suffice.
Using the auto format from Eclipse, Ctrl + Shift + F, then save and then undo (Ctrl + Z), the error miraculously disappeared.
Still ain't sure why the scenario is like this though.
Upvotes: 2
Reputation: 956
I came across the same error in STS 3.9.4 which is built on top of Eclipse Oxygen. This is thrown by the Json Validator used by Eclipse editor implementation due to the presence of the embedded comments within the Json file. Though, at runtime, this is ignored by the Jackson marshaller implementation used by the Spring Boot. Only that, Eclipse's JSON validator seems to be strict about the comments.
So, I configured the editor preferences to exclude the file from doing JSON validation as suggested at here - https://stackoverflow.com/a/41704569/5107365.
Upvotes: 0
Reputation: 2297
You haven't closed the }
at the end of the json. The correct json would be as follows.
{
"menu" : {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{ "value" : "New", "onclick": "CreateNewDoc()" },
{ "value" : "Open", "onclick": "OpenDoc()" },
{ "value" : "Close", "onclick": "CloseDoc()" }
]
}
}
}
Upvotes: 2