First of all, you cannot hide individual context menu options using JSON formatting. You can only customize/hide options from command bar at the top.
You can hide "Share" option from command bar using `` as key like:
```
{
"key": "share",
"hide": true
}
```
**Documentation**: [Command bar customization syntax reference](https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-commandbar-formatting)
<hr>
You can hide complete context menu from **list** view using two methods:
**Method 1 - SharePoint OOTB**:
In SharePoint list, Title column has three different variants:
- Title
- Title (linked to item)
- Title (linked to item with edit menu)
So, you can use plain "Title" column in your list view to hide context menu.
**Method 2 - JSON formatting**:
You can add simple JSON formatting on Title column like below to hide context menu:
```
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField"
}
```
While using JSON formatting, you will loose all OOTB functionality formatting for Title column including default click which open display/view form of list, you can get it back using JSON formatting on Title column like:
```
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"customRowAction": {
"action": "defaultClick"
},
"attributes": {
"class": "sp-field-underline"
}
}
```
<hr>
**Update from comments**:
As you are using document library, you have to apply column formatting on **Name** column instead of **Title** column: :
Format option:
[![enter image description here][1]][1]
Then go to "Advanced mode":
[![enter image description here][2]][2]
Copy-paste above JSON and click "Save":
[![enter image description here][3]][3]
You can apply additional styling as per your requirements. Check below documentation for more information:
1. [Use Column formatting in SharePoint](https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting)
2. [JSON formatting-syntax-reference](https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/formatting-syntax-reference)
[1]: https://i.sstatic.net/jjLhb.png
[2]: https://i.sstatic.net/cWt2r.png
[3]: https://i.sstatic.net/QX51I.png