Single line JSON file???
YFP-56
Posted messages
2
Status
Membre
-
jordane45 Posted messages 30426 Registration date Status Modérateur Last intervention -
jordane45 Posted messages 30426 Registration date Status Modérateur Last intervention -
Hello,
I created a fairly long JSON file using Notepad (I also tried with Notepad++).
For now, I have placed all the data on a single line (here's a small part):
data ='[{"fed" : 13},{"fed" : "etre"},{"fed" : "un deiz all eo"},{"fed" : "BIKEN"},{"fed" : "BIRVIKEN"},{"fed" : "BISKOAZH"}, (etc...)
And it works perfectly like this.
BUT if I try to write it over multiple lines for better readability:
data ='[{"fed" : 13},
{"fed" : "etre"},
{"fed" : "un deiz all eo"},
{"fed" : "BIKEN"},
(etc....)
=> I get an error message when launching the program (javascript) (console: "invalid character" (this corresponds to the line break):
What should I do? All the JSON file examples I found on the internet are written over multiple lines!
Thank you in advance.
I created a fairly long JSON file using Notepad (I also tried with Notepad++).
For now, I have placed all the data on a single line (here's a small part):
data ='[{"fed" : 13},{"fed" : "etre"},{"fed" : "un deiz all eo"},{"fed" : "BIKEN"},{"fed" : "BIRVIKEN"},{"fed" : "BISKOAZH"}, (etc...)
And it works perfectly like this.
BUT if I try to write it over multiple lines for better readability:
data ='[{"fed" : 13},
{"fed" : "etre"},
{"fed" : "un deiz all eo"},
{"fed" : "BIKEN"},
(etc....)
=> I get an error message when launching the program (javascript) (console: "invalid character" (this corresponds to the line break):
What should I do? All the JSON file examples I found on the internet are written over multiple lines!
Thank you in advance.
1 réponse
Hello
A JSON cannot, in any case, start with
data ='
A JSON always starts with a brace..
In any case, there are websites where you can check the validity of the JSON format.
For example: https://jsonformatter.curiousconcept.com/
--
.
Best regards,
Jordane
A JSON cannot, in any case, start with
data ='
A JSON always starts with a brace..
In any case, there are websites where you can check the validity of the JSON format.
For example: https://jsonformatter.curiousconcept.com/
--
.
Best regards,
Jordane