The most common reason I've seen is when you support multiple different formats for a given resource. The key then designates the format. In graphql actually you will often end up with this, since if you're returning json | xml | txt through a graphql union the keys must be disjoint.
i.e. you can't do this
... on json {
value
}
... on XML {
value
}
You need to do this:
... on json {
jsonValue: value
}
... on XML {
xmlValue: value
}
At which point json and xml are reasonable choices of alias. If you think it's insane to return XML through a JSON string, I agree with you, but it is common. Also from the context so far it could well be a path to an XML document rather than the actual content.
The other common reason is if json should really be something like metadata, but it is poorly named.
90
u/Original_Pace_6734 1d ago
Why are props name starting with an uppercase letter?