If I have to deserialize a response like this:

{ "Property1" : "value", "Property2" : "value2" } 

Do I have to respect the case of the property names? I would rather use camel case to stick with our Apex naming conventions, e.g:

class Response {
    String property1;
    String property2;

Response res = (Response)JSON.deserialize(myJson, Response.class);

2 Answers 2


This doesn't matter when you're doing typed deserialization, but it will be an issue if you do untyped deserialization because any Map<String, Object> that you pull out will necessarily have case-sensitive keys.

Case insensitive

JSON.deserialize(jsonString, SpecificType.class)
JSON.deserializeStrict(jsonString, SpecificType.class)

Case Sensitive


  • 1
    Worth also noting that JSON.deserializeStrict is also case insensitive for keys. Values may, of course, be case sensitive depending on their type and how they are used in the code.
    – Phil W
    Commented Jul 10, 2023 at 13:16
  • 1
    I suppose that JSONParser is also case-insensitive (due to string comparison being case-insensitive by default), but if you're using JSONParser over one of the JSON.deserialize* methods you're either doing something wrong or you already know exactly what you're doing.
    – Derek F
    Commented Jul 10, 2023 at 14:02

You do not need to respect the case of the properties in the JSON string you are deserializing.

JSON deserialization in Apex is not case sensitive.

The above code will work fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .