Those are both valid syntaxes. I don't think Elixir nor Credo should warn. If another serialization becomes wide-spread in the future in a way it also causes confusion with Elixir syntax, should we also deprecate that other part of the Elixir syntax? The rationale of why it works in Elixir is because we allow :"such an atom" and keywords keep the same syntax except ":" is used at the end.
If you are writing a lot of JSON, maybe one idea is to use a sigil so you can literally write JSON?
~j"""
{
json: "this is literally json"
}
"""
The json can be converted to a data structure at compile-time if you don't have an interpolation. And if you have interpolation, you can probably change each interpolated argument to encode to json. So you can even do things such as:
sub = ~j"""
{foo: "bar"}
"""
~j"""
{total: #{sub}}
"""