Description
When serializing MessageCreateParams.Body to JSON (e.g. for logging or debugging), the resulting body has messages appearing before system:
{
"max_tokens": 16000,
"messages": [
{ "role": "user", "content": "..." }
],
"model": "claude-sonnet-4-6",
"system": "You are a ...",
"temperature": 0.5,
"tools": [...],
"tool_choice": {...}
}
This is caused by the alphabetical order of @JsonProperty-annotated getter methods in Body — messages (m) comes before system (s).
Question
Does the Anthropic Messages API treat JSON field order as significant? Specifically — is there any requirement or recommendation that system should appear before messages in the request body?
Both prompt engineers and AI engineers on our team insist that for Claude models the field order matters semantically — specifically that system must precede messages in the request body for the model to process the system prompt correctly. We have not been able to find any mention of this requirement in the official documentation. RFC 7159 defines JSON objects as unordered, so we assume the API parses fields by name regardless of position. We would appreciate an official clarification on this point.
Or document explicitly that field order is irrelevant, so integrators can stop worrying about it.
Thank u!

Description
When serializing
MessageCreateParams.Bodyto JSON (e.g. for logging or debugging), the resulting body hasmessagesappearing beforesystem:{
"max_tokens": 16000,
"messages": [
{ "role": "user", "content": "..." }
],
"model": "claude-sonnet-4-6",
"system": "You are a ...",
"temperature": 0.5,
"tools": [...],
"tool_choice": {...}
}
This is caused by the alphabetical order of @JsonProperty-annotated getter methods in Body —
messages(m) comes beforesystem(s).Question
Does the Anthropic Messages API treat JSON field order as significant? Specifically — is there any requirement or recommendation that
systemshould appear beforemessagesin the request body?Both prompt engineers and AI engineers on our team insist that for Claude models the field order matters semantically — specifically that
systemmust precedemessagesin the request body for the model to process the system prompt correctly. We have not been able to find any mention of this requirement in the official documentation. RFC 7159 defines JSON objects as unordered, so we assume the API parses fields by name regardless of position. We would appreciate an official clarification on this point.Or document explicitly that field order is irrelevant, so integrators can stop worrying about it.
Thank u!