Answer the question
In order to leave comments, you need to log in
How can I find out what JSON is being passed?
Engaged in the development of the server part for the application. I use Node js as a server. So, data from the application comes to the server in JSON format, it is parsed there, checked and transmitted back. But if you send any other string to the server
, for example "dhsdsds", then Node.js immediately crashes without giving any errors. Can someone tell me how to find out that the string is in JSON format?
Answer the question
In order to leave comments, you need to log in
var parsedData;
try {
parsedData = JSON.parse(data)
} catch (e) {
// is not a valid JSON string
}
try {
jQuery.parseJSON(response);
} catch(error) {
// это не json
}
The server on http twitches? Decent people use headers like
Content-Type: application/json . Filter by it.
Node.js, by the way, is suddenly not a "language for the server" and not a "language" at all.
as a language
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question