JSON is located at:
When I use the online tool:
I get the following error messages:
Error:Invalid media type, expecting application/json.[Code 28,Structure 0]
Error:Invalid encoding, expecting UTF-8, UTF-16 or UTF-32.[Code 29, Structure 0]
JSON is located at:
When I use the online tool:
I get the following error messages:
Error:Invalid media type, expecting application/json.[Code 28,Structure 0]
Error:Invalid encoding, expecting UTF-8, UTF-16 or UTF-32.[Code 29, Structure 0]
thanks @dubes
what worked for me, after doing everything! change this:
Content-type: application/json; charset=utf-8
to:
Content-type: application/json; charset=UTF-8
(caps)!
Assuming: You are pasting the "url" in the jsonformatter to validate the json.
Your JSON is structurally valid.
The errors shown are related to the missing metadata about content that your service should expose. Typically the client that would consume any resources you may expose over the network might/would like to know (among other things):
The client would look for this information in the Content-type
response header.
The server/service exposing that JSON, is not setting the Content-type: application/json; charset=utf-8
in the response header, thus the tool raises the error.
Edit (Bonus tip): If you have any confusion about the content header for the json, would definitely recommend reading this question
use single line code in your php api file
header('Content-type: application/json; charset=UTF-8');
I thing the JSON data exceeds the maximum number of characters so, the error showing, if you partially valid the json file , the error will not show.