While working on Unity plugin project I need to map JSON to the C# objects. For this task I used modification of the fastJSON library. But fastJSON use codegeneration for creating special methods for reading/writing object properties. It looks like:
il.Emit(OpCodes.Ldarg_0);
il.Emit(OpCodes.Ldarg_1);
if (fieldInfo.FieldType.IsValueType)
il.Emit(OpCodes.Unbox_Any, fieldInfo.FieldType);