Answer the question
In order to leave comments, you need to log in
How to determine the format of the message that came to the server - Json or just a string?
I want to send json messages to the server and just strings, numbers. How can I determine what format the message from the client carries?
Answer the question
In order to leave comments, you need to log in
You parse (unmarshal) as JSON, if there is an error, you consider it a simple string.
Look at the HTTP header Content-Type . If there is application/json , then the output is obvious! If we are talking about an HTTP server, of course, but with others it is similar - there are service headers that determine the data format.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question