Question: I have a list of JSON objects, each of which I'm iterating over and I simply want to process all of the KeyValuePairs therein so that the keys are uppercased, then return the revised objects. 

This is what I attempted: 

```
 public static List<JObject> normalizeKeys(List<JObject> jObjList)
    {
        jObjList.ForEach(jobj => {
            foreach(var kvp in jobj)
            {
                kvp.Key = kvp.Key.ToUpper();
            }
        });

        return jObjList;

    }

```

but it doesn't execute and instead I get `KeyValuePair<string, JToken>.Key cannot be assigned to -- it is readonly.` Does anyone have any suggestions for how to accomplish what I'm after?

Answer: 
Though the given answer works, I would be inclined to say that it is both not as elegant as it could be, and not as generally useful as it could be. We can make it more of both. To begin with, solve the problem for *one* object:

```
public static JObject NormalizeKeys(JObject originalObject)
{
    var newObject = new JObject();
    foreach (var kvp in originalObject)
        newObject.Add(kvp.Key.ToUpper(), kvp.Value);
    return newObject;
}

```

And now to solve the problem for a list:

```
var newList = oldList.Select(x=>NormalizeKeys(x)).ToList();

```

Or, even shorter:

```
var newList = oldList.Select(NormalizeKeys).ToList();

```

Isn't that much more pleasant than all that nested loop stuff? Say how to normalize one object, and then say that you want to apply that function to the list, and you're done.
Guess you know the answer yourself, you must create a new collection and copy the items over, since key is key, it's case sensitive, and cannot be changed, as otherwise you might end up with probably 2 sets of data, one set with normal case, and the other with upper cases.

The solution is as the following:

```
public static List<JObject> normalizeKeys(List<JObject> jObjList)
{
    // create a new list for return and copy over the existing items
    var jObjReturnList = new List<JObject>(jObjList.Count);
    jObjList.ForEach(jobj =>
    {
        var jObjNew = new JObject();
        foreach (var kvp in jobj)
        {
            jObjNew.Add(kvp.Key.ToUpper(), kvp.Value);
        }

        jObjReturnList.Add(jObjNew);
    });

    return jObjReturnList;
}

```