How to get TMap pair's value?

Basically, when iterating fields, you need to use ContainerPtrToValuePtr, but you don’t need to use it when iterating the contents of a container. I’d try and move the calls to ContainerPtrToValuePtr to the code that deals with the field iteration, rather than having that logic in the code that deals with the property.

I’ve made an example here. This builds, but I have no idea if it produces valid JSON - it should help you understand our reflection though.

In the code I pasted, ObjectToJsonString and StructToJsonString are what handle enumerating the fields within an object or struct (using TFieldIterator rather than by hand like you were doing) - these take care of calling ContainerPtrToValuePtr before passing the value into PropertyValueToJsonString.

PropertyValueToJsonString is what takes care of converting a property and its associated data to a string. It will call itself recursively when dealing with UArrayProperty and UMapProperty, passing in the pre-offset values and avoiding a call to ContainerPtrToValuePtr.

My PropertyValueToJsonString also only introduces custom behaviour for the properties that need it (containers, objects, and structs), and uses the generic ExportText_Direct functionality to deal with stringifying everything else (PPF_Delimited makes sure that strings and such are quoted and correctly escaped).