Repository: FlaxEngine/FlaxEngine
File: Source/Editor/Windows/Assets/JsonAssetWindow.cs (C#)

Code before:
            };
            typeText.LocalX += -(typeText.Width + _optionsButton.Width + 8);
            typeText.LocalY += (_toolstrip.Height - typeText.Height) * 0.5f;
            _typeText = typeText;

            _undo.Clear();
            ClearEditedFlag();

            // Auto-close on scripting reload if json asset is from game scripts (it might be reloaded)
            if ((_object == null || FlaxEngine.Scripting.IsTypeFromGameScripts(_object.GetType())) && !_isRegisteredForScriptsReload)
            {
                _isRegisteredForScriptsReload = true;
                ScriptsBuilder.ScriptsReloadBegin += OnScriptsReloadBegin;
            }

            base.OnAssetLoaded();
        }

        private void OpenOptionsContextMenu()
        {
            if (_optionsCM != null && _optionsCM.ContainsFocus)
                return;
            
            _optionsCM = new ContextMenu();
            _optionsCM.AddButton("Copy type name", () => Clipboard.Text = Asset.DataTypeName);
            _optionsCM.AddButton("Copy Asset data", () => Clipboard.Text = Asset.Data);
            _optionsCM.AddButton("Paste Asset data", () =>
            {
                if (!string.IsNullOrEmpty(Clipboard.Text))
                {
                    var dataTypeName = Asset.DataTypeName;
                    var type = TypeUtils.GetType(dataTypeName);
                    if (type != null)
                    {
                        try
                        {
                            var obj = Activator.CreateInstance(type.Type);
                            var data = Clipboard.Text;
                            JsonSerializer.Deserialize(obj, data);
                            if (obj != null)
                            {
                                var undoAction = new ObjectPasteUndo(_object, obj, this);
                                undoAction.Do();
                                _undo.AddAction(undoAction);
                            }
                            else
                            {
                                Editor.LogWarning("Pasted data is not the correct data type or has incomplete data");
                            }
                        }
                        catch (Exception ex)

Review comment (suggestion):
Let's change `Asset` to `asset` lowercase to maintain the case in the context menu (I'm aware it could be already made that way in other Editor parts)

Code after:
                Parent = this,
            };
            typeText.LocalX += -(typeText.Width + _optionsButton.Width + 8);
            typeText.LocalY += (_toolstrip.Height - typeText.Height) * 0.5f;
            _typeText = typeText;

            _undo.Clear();
            ClearEditedFlag();

            // Auto-close on scripting reload if json asset is from game scripts (it might be reloaded)
            if ((_object == null || FlaxEngine.Scripting.IsTypeFromGameScripts(_object.GetType())) && !_isRegisteredForScriptsReload)
            {
                _isRegisteredForScriptsReload = true;
                ScriptsBuilder.ScriptsReloadBegin += OnScriptsReloadBegin;
            }

            base.OnAssetLoaded();
        }

        private void OpenOptionsContextMenu()
        {
            if (_optionsCM != null && _optionsCM.ContainsFocus)
                return;
            
            _optionsCM = new ContextMenu();
            _optionsCM.AddButton("Copy type name", () => Clipboard.Text = Asset.DataTypeName);
            _optionsCM.AddButton("Copy asset data", () => Clipboard.Text = Asset.Data);
            _optionsCM.AddButton("Paste asset data", () =>
            {
                if (!string.IsNullOrEmpty(Clipboard.Text))
                {
                    var dataTypeName = Asset.DataTypeName;
                    var type = TypeUtils.GetType(dataTypeName);
                    if (type != null)
                    {
                        try
                        {
                            var obj = Activator.CreateInstance(type.Type);
                            var data = Clipboard.Text;
                            JsonSerializer.Deserialize(obj, data);
                            if (obj != null)
                            {
                                var undoAction = new ObjectPasteUndo(_object, obj, this);
                                undoAction.Do();
                                _undo.AddAction(undoAction);
                            }
                            else
                            {
                                Editor.LogWarning("Pasted data is not the correct data type or has incomplete data");
                            }
                        }