Support JSON ContentType
See original GitHub issueI’d like to use this template language to fill in some large JSON. Do you think it makes sense to have a ContentType.Json
, that escapes all JSON values like done here in JsonValue.escape()?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Which JSON content type do I use? - Stack Overflow
The right content type for JSON is application/json UNLESS you're using JSONP, also known as ...
Read more >What is the Correct Content-Type for JSON? Request Header ...
The Correct Content-Type for JSON. JSON has to be correctly interpreted by the browser to be used appropriately. text/plain was typically used ...
Read more >What is the correct JSON content type ? - GeeksforGeeks
What is the correct JSON content type ? ... Content-Type is an HTTP header that is used to indicate the media type of...
Read more >How to Set JSON Content Type In Spring MVC - Baeldung
Learn different options for setting the content type in Spring MVC. ... Let's start with a simple example of an API exposing a...
Read more >What is the correct Content Type for JSON? - ReqBin
The correct content type for JSONP (padded JSON) is application/javascript. For JSON-LD (JSON-linked data), the correct content type is ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just for the internet archive and google. I solved this with a special output, that escapes user content like this
I used the escape logic from minimal-json at https://github.com/ralfstx/minimal-json/blob/master/com.eclipsesource.json/src/main/java/com/eclipsesource/json/JsonWriter.java
@spinscale Seems like it’s easy enough to solve without specialized support. Instead of only escaping strings, something like fastjson’s
JSON.toJSONString()
converting any object might be good.It might be a good idea to decouple some things, so full support can be implemented by plug-ins.