In general, we don’t typically “customize the json”, as much as we customize the resource itself. We can potentially add things like rename_fields [foo: "SomethingElse], which we do on an as-needed basis, but if you wanted to do something like add a field in the response for a calculated value, you’d add a calculation
calculate :full_name, :string, expr(first_name <> " " <> last_name)
and then that calculation can be requested by users with ?fields=foo,bar,full_name.
You can configure what fields are included by default with
json_api do
default_fields [:foo, :bar, :full_name]
end
and then they won’t need to be requested.
ash_json_api is built to be a JSON:API compliant API, which is why the structure is relatively rigid.






















