All-uppercase strings and `camelCase` JSON serialization (in .NET)

I was recently debugging an issue where two systems expected the contract to be using the camelCase style, but miscommunicated because they assumed a different transformation result for an all-uppercase string like URL:

  • System 1 serialized it as url
  • System 2 serialized it as uRL

Which of them was right, and which was buggy?

The short answer is that there’s no single industry standard defining what is right here. Libraries might handle edge cases differently. If you need compatibility, it’s helpful to examine the libraries you need to ensure they are doing what you expect.

Experiment: .NET serializers vs all-uppercase strings

Acronyms and abbreviations are common in property names. Objects might contain properties containing strings like URL, API, HTTP etc. Such property names are transformed differently depending on the serializer and settings you use.

This experiment examines how popular .NET JSON serializers handle acronym casing when converting strings to camelCase during serialization.

SerializerStyleURLURLPathMyURLIOStreamM4AFileName
Newtonsoft.JsonCamelCaseurlurlPathmyURLioStreamm4AFileName
System.Text.JsonCamelCaseurlurlPathmyURLioStreamm4AFileName
Newtonsoft.JsonDefaultURLURLPathMyURLIOStreamM4AFileName
System.Text.JsonDefaultURLURLPathMyURLIOStreamM4AFileName
Newtonsoft.JsonSnakeCaseurlurl_pathmy_urlio_streamm4_a_file_name
System.Text.JsonSnakeCaseLowerurlurl_pathmy_urlio_streamm4_a_file_name
Newtonsoft.JsonKebabCaseurlurl-pathmy-urlio-streamm4-a-file-name
System.Text.JsonKebabCaseLowerurlurl-pathmy-urlio-streamm4-a-file-name

Conclusions

The key learnings for me are:

  1. In camelCase style, acronyms at the beginning of property names are handled differently from the ones in the middle/end of the string.
  2. System.Text.Json and Newtonsoft.Json transform acronyms to lowercase in the same way in all cases I tested, suggesting high compatibility of those style transformations.
  3. Many state-of-the-art LLM models are confused about this in 2025 and suggest the output would lowercase only the first letter (e.g., URL → uRL), which is not true for the popular .NET serializers.
  4. If you want to convert a string to camelCase style, don’t let LLMs trick you into oversimplified implementations that only replace the first character of the string. Instead, use a mature library like System.Text.Json to do it for you!

Good luck 🙂