Flattens Go structs for JSON encoding.