I was wondering if there is a good way for JSON files to be listed with the listings
package.
The only language definition I could come up with, is this:
\lstdefinelanguage{json}
{
morestring=[b]",
morestring=[d]'
}
Now, this highlights the strings used in JSON files, but the important syntactical things in JSON are the curly braces, the square brackets, commas, and colons. I have sadly no Idea how I could make them be highlighted in a different manner. I tried adding {
and }
as identifier or as keywords, but it didn't work.
I'd really like to make listed JSON files appear nicer, since on a project I need to document I'd really need it. Also, I couldn't find a JSON definition for that on the internet, anywhere else.
On a more general thought: can I highlight all numerals with listings?
{
are not accepted as keywords. Or I'm doing something wrong.[b]
type as they are backslash-escaped in JSON (and Javascript).