<?xml version='1.0' encoding='utf-8'?>
<FilingSummary>
  <Version>3.24.3</Version>
  <ProcessingTime/>
  <ReportFormat>html</ReportFormat>
  <ContextCount>82</ContextCount>
  <ElementCount>232</ElementCount>
  <EntityCount>1</EntityCount>
  <FootnotesReported>true</FootnotesReported>
  <SegmentCount>27</SegmentCount>
  <ScenarioCount>0</ScenarioCount>
  <TuplesReported>false</TuplesReported>
  <UnitCount>5</UnitCount>
  <MyReports>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R1.htm</HtmlFileName>
      <LongName>100000 - Document - Cover Page</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/CoverPage</Role>
      <ShortName>Cover Page</ShortName>
      <MenuCategory>Cover</MenuCategory>
      <Position>1</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R2.htm</HtmlFileName>
      <LongName>100010 - Statement - Consolidated Statements of Comprehensive Income</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/ConsolidatedStatementsOfComprehensiveIncome</Role>
      <ShortName>Consolidated Statements of Comprehensive Income</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>2</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R3.htm</HtmlFileName>
      <LongName>100030 - Statement - Consolidated Statements of Comprehensive Income (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/ConsolidatedStatementsOfComprehensiveIncomeParenthetical</Role>
      <ShortName>Consolidated Statements of Comprehensive Income (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>3</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R4.htm</HtmlFileName>
      <LongName>100040 - Statement - Consolidated Balance Sheets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/ConsolidatedBalanceSheets</Role>
      <ShortName>Consolidated Balance Sheets</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>4</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R5.htm</HtmlFileName>
      <LongName>100050 - Statement - Consolidated Balance Sheets (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/ConsolidatedBalanceSheetsParenthetical</Role>
      <ShortName>Consolidated Balance Sheets (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>5</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R6.htm</HtmlFileName>
      <LongName>100060 - Statement - Consolidated Statements of Stockholders' Equity</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/ConsolidatedStatementsOfStockholdersEquity</Role>
      <ShortName>Consolidated Statements of Stockholders' Equity</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>6</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R7.htm</HtmlFileName>
      <LongName>100070 - Statement - Consolidated Statements of Stockholders' Equity (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/ConsolidatedStatementsOfStockholdersEquityParenthetical</Role>
      <ShortName>Consolidated Statements of Stockholders' Equity (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>7</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R8.htm</HtmlFileName>
      <LongName>100080 - Statement - Consolidated Statements of Cash Flows</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/ConsolidatedStatementsOfCashFlows</Role>
      <ShortName>Consolidated Statements of Cash Flows</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>8</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R9.htm</HtmlFileName>
      <LongName>995410 - Disclosure - Pay vs Performance Disclosure</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://xbrl.sec.gov/ecd/role/PvpDisclosure</Role>
      <ShortName>Pay vs Performance Disclosure</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>9</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R10.htm</HtmlFileName>
      <LongName>995445 - Disclosure - Insider Trading Arrangements</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://xbrl.sec.gov/ecd/role/InsiderTradingArrangements</Role>
      <ShortName>Insider Trading Arrangements</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>10</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R11.htm</HtmlFileName>
      <LongName>995455 - Disclosure - Basis of Presentation and Description of Business</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/BasisOfPresentationAndDescriptionOfBusiness</Role>
      <ShortName>Basis of Presentation and Description of Business</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>11</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R12.htm</HtmlFileName>
      <LongName>995475 - Disclosure - Revenue Recognition</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/RevenueRecognition</Role>
      <ShortName>Revenue Recognition</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>12</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R13.htm</HtmlFileName>
      <LongName>995485 - Disclosure - Leases</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/Leases</Role>
      <ShortName>Leases</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>13</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R14.htm</HtmlFileName>
      <LongName>995495 - Disclosure - Inventories</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/Inventories</Role>
      <ShortName>Inventories</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>14</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R15.htm</HtmlFileName>
      <LongName>995505 - Disclosure - Goodwill and Intangible Assets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/GoodwillAndIntangibleAssets</Role>
      <ShortName>Goodwill and Intangible Assets</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>15</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R16.htm</HtmlFileName>
      <LongName>995515 - Disclosure - Credit Facility</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/CreditFacility</Role>
      <ShortName>Credit Facility</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>16</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R17.htm</HtmlFileName>
      <LongName>995525 - Disclosure - Earnings Per Common Share</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/EarningsPerCommonShare</Role>
      <ShortName>Earnings Per Common Share</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>17</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R18.htm</HtmlFileName>
      <LongName>995535 - Disclosure - Stock-Based Compensation Plans</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/StockBasedCompensationPlans</Role>
      <ShortName>Stock-Based Compensation Plans</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>18</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R19.htm</HtmlFileName>
      <LongName>995545 - Disclosure - Retirement Plan</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/RetirementPlan</Role>
      <ShortName>Retirement Plan</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>19</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R20.htm</HtmlFileName>
      <LongName>995565 - Disclosure - Commitments and Contingent Liabilities</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/CommitmentsAndContingentLiabilities</Role>
      <ShortName>Commitments and Contingent Liabilities</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>20</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R21.htm</HtmlFileName>
      <LongName>995575 - Disclosure - Fair Value of Financial Instruments</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/FairValueOfFinancialInstruments</Role>
      <ShortName>Fair Value of Financial Instruments</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>21</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R22.htm</HtmlFileName>
      <LongName>995595 - Disclosure - Recent Accounting Pronouncements</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/RecentAccountingPronouncements</Role>
      <ShortName>Recent Accounting Pronouncements</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>22</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R23.htm</HtmlFileName>
      <LongName>995625 - Disclosure - Revenue Recognition (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/RevenueRecognitionTables</Role>
      <ShortName>Revenue Recognition (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://jbssinc.com/20240926/taxonomy/role/RevenueRecognition</ParentRole>
      <Position>23</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R24.htm</HtmlFileName>
      <LongName>995635 - Disclosure - Leases (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/LeasesTables</Role>
      <ShortName>Leases (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://jbssinc.com/20240926/taxonomy/role/Leases</ParentRole>
      <Position>24</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R25.htm</HtmlFileName>
      <LongName>995645 - Disclosure - Inventories (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/InventoriesTables</Role>
      <ShortName>Inventories (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://jbssinc.com/20240926/taxonomy/role/Inventories</ParentRole>
      <Position>25</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R26.htm</HtmlFileName>
      <LongName>995655 - Disclosure - Goodwill and Intangible Assets (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/GoodwillAndIntangibleAssetsTables</Role>
      <ShortName>Goodwill and Intangible Assets (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://jbssinc.com/20240926/taxonomy/role/GoodwillAndIntangibleAssets</ParentRole>
      <Position>26</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R27.htm</HtmlFileName>
      <LongName>995665 - Disclosure - Earnings Per Common Share (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/EarningsPerCommonShareTables</Role>
      <ShortName>Earnings Per Common Share (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://jbssinc.com/20240926/taxonomy/role/EarningsPerCommonShare</ParentRole>
      <Position>27</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R28.htm</HtmlFileName>
      <LongName>995685 - Disclosure - Retirement Plan (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/RetirementPlanTables</Role>
      <ShortName>Retirement Plan (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://jbssinc.com/20240926/taxonomy/role/RetirementPlan</ParentRole>
      <Position>28</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R29.htm</HtmlFileName>
      <LongName>995705 - Disclosure - Fair Value of Financial Instruments (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/FairValueOfFinancialInstrumentsTables</Role>
      <ShortName>Fair Value of Financial Instruments (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://jbssinc.com/20240926/taxonomy/role/FairValueOfFinancialInstruments</ParentRole>
      <Position>29</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R30.htm</HtmlFileName>
      <LongName>995715 - Disclosure - Basis of Presentation and Description of Business - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/BasisOfPresentationAndDescriptionOfBusinessAdditionalInformationDetail</Role>
      <ShortName>Basis of Presentation and Description of Business - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>30</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R31.htm</HtmlFileName>
      <LongName>995755 - Disclosure - Revenue Recognition - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/RevenueRecognitionAdditionalInformationDetail</Role>
      <ShortName>Revenue Recognition - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>31</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R32.htm</HtmlFileName>
      <LongName>995765 - Disclosure - Revenue Recognition - Summary of Revenue Disaggregated by Sales Channel (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/RevenueRecognitionSummaryOfRevenueDisaggregatedBySalesChannelDetail</Role>
      <ShortName>Revenue Recognition - Summary of Revenue Disaggregated by Sales Channel (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>32</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R33.htm</HtmlFileName>
      <LongName>995775 - Disclosure - Leases - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/LeasesAdditionalInformationDetail</Role>
      <ShortName>Leases - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>33</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R34.htm</HtmlFileName>
      <LongName>995785 - Disclosure - Leases - Operating Lease Assets And Liabilities (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/LeasesOperatingLeaseAssetsAndLiabilitiesDetail</Role>
      <ShortName>Leases - Operating Lease Assets And Liabilities (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>34</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R35.htm</HtmlFileName>
      <LongName>995795 - Disclosure - Leases - Lease Cost (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/LeasesLeaseCostDetail</Role>
      <ShortName>Leases - Lease Cost (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>35</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R36.htm</HtmlFileName>
      <LongName>995805 - Disclosure - Leases - Operating Leases Cash Flow Related Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/LeasesOperatingLeasesCashFlowRelatedInformationDetail</Role>
      <ShortName>Leases - Operating Leases Cash Flow Related Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>36</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R37.htm</HtmlFileName>
      <LongName>995815 - Disclosure - Leases - Other Information Related to Operating Lease (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/LeasesOtherInformationRelatedToOperatingLeaseDetail</Role>
      <ShortName>Leases - Other Information Related to Operating Lease (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>37</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R38.htm</HtmlFileName>
      <LongName>995825 - Disclosure - Leases - Lessee Operating Lease Liability Maturity (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/LeasesLesseeOperatingLeaseLiabilityMaturityDetail</Role>
      <ShortName>Leases - Lessee Operating Lease Liability Maturity (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>38</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R39.htm</HtmlFileName>
      <LongName>995835 - Disclosure - Leases - Operating Lease Revenue (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/LeasesOperatingLeaseRevenueDetail</Role>
      <ShortName>Leases - Operating Lease Revenue (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>39</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R40.htm</HtmlFileName>
      <LongName>995845 - Disclosure - Leases - Lessor Operating Lease Payments To Be Received Maturity (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/LeasesLessorOperatingLeasePaymentsToBeReceivedMaturityDetail</Role>
      <ShortName>Leases - Lessor Operating Lease Payments To Be Received Maturity (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>40</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R41.htm</HtmlFileName>
      <LongName>995855 - Disclosure - Inventories - Components of Inventories (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/InventoriesComponentsOfInventoriesDetail</Role>
      <ShortName>Inventories - Components of Inventories (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>41</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R42.htm</HtmlFileName>
      <LongName>995865 - Disclosure - Goodwill and Intangible Assets - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/GoodwillAndIntangibleAssetsAdditionalInformationDetail</Role>
      <ShortName>Goodwill and Intangible Assets - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>42</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R43.htm</HtmlFileName>
      <LongName>995875 - Disclosure - Goodwill and Intangible Assets - Components of Identifiable Intangible Assets (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/GoodwillAndIntangibleAssetsComponentsOfIdentifiableIntangibleAssetsDetail</Role>
      <ShortName>Goodwill and Intangible Assets - Components of Identifiable Intangible Assets (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>43</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R44.htm</HtmlFileName>
      <LongName>995885 - Disclosure - Goodwill and Intangible Assets - Summary of Expected Amortization Expense (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/GoodwillAndIntangibleAssetsSummaryOfExpectedAmortizationExpenseDetail</Role>
      <ShortName>Goodwill and Intangible Assets - Summary of Expected Amortization Expense (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>44</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R45.htm</HtmlFileName>
      <LongName>995895 - Disclosure - Goodwill and Intangible Assets - Summary of Changes in Carrying Amount of Goodwill (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/GoodwillAndIntangibleAssetsSummaryOfChangesInCarryingAmountOfGoodwillDetail</Role>
      <ShortName>Goodwill and Intangible Assets - Summary of Changes in Carrying Amount of Goodwill (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>45</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R46.htm</HtmlFileName>
      <LongName>995905 - Disclosure - Credit Facility - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/CreditFacilityAdditionalInformationDetail</Role>
      <ShortName>Credit Facility - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>46</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R47.htm</HtmlFileName>
      <LongName>995915 - Disclosure - Earnings Per Common Share - Weighted Average Shares Outstanding Used in Computing Basic and Diluted Earnings Per Share (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/EarningsPerCommonShareWeightedAverageSharesOutstandingUsedInComputingBasicAndDilutedEarningsPerShareDetail</Role>
      <ShortName>Earnings Per Common Share - Weighted Average Shares Outstanding Used in Computing Basic and Diluted Earnings Per Share (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>47</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R48.htm</HtmlFileName>
      <LongName>995925 - Disclosure - Earnings Per Common Share - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/EarningsPerCommonShareAdditionalInformationDetail</Role>
      <ShortName>Earnings Per Common Share - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>48</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R49.htm</HtmlFileName>
      <LongName>995935 - Disclosure - Stock-Based Compensation Plans - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/StockBasedCompensationPlansAdditionalInformationDetail</Role>
      <ShortName>Stock-Based Compensation Plans - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>49</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R50.htm</HtmlFileName>
      <LongName>995965 - Disclosure - Retirement Plan - Schedule of Net Periodic Benefit Cost (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/RetirementPlanScheduleOfNetPeriodicBenefitCostDetail</Role>
      <ShortName>Retirement Plan - Schedule of Net Periodic Benefit Cost (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>50</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R51.htm</HtmlFileName>
      <LongName>995975 - Disclosure - Accumulated Other Comprehensive Loss - Changes in Accumulated Other Comprehensive Loss (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/AccumulatedOtherComprehensiveLossChangesInAccumulatedOtherComprehensiveLossDetail</Role>
      <ShortName>Accumulated Other Comprehensive Loss - Changes in Accumulated Other Comprehensive Loss (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>51</Position>
    </Report>
    <Report instance="jbss-20240926.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R52.htm</HtmlFileName>
      <LongName>995995 - Disclosure - Fair Value of Financial Instruments - Carrying Value and Fair Value Estimate of Current and Long-Term Debt (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://jbssinc.com/20240926/taxonomy/role/DisclosureFairValueOfFinancialInstrumentsCarryingValueAndFairValueEstimateOfCurrentAndLongtermDebtDetails</Role>
      <ShortName>Fair Value of Financial Instruments - Carrying Value and Fair Value Estimate of Current and Long-Term Debt (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>52</Position>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <LongName>All Reports</LongName>
      <ReportType>Book</ReportType>
      <ShortName>All Reports</ShortName>
    </Report>
  </MyReports>
  <InputFiles>
    <File doctype="10-Q" isDefinitelyFs="true" isUsgaap="true" original="jbss-20240926.htm">jbss-20240926.htm</File>
    <File>jbss-20240926.xsd</File>
  </InputFiles>
  <SupplementalFiles/>
  <BaseTaxonomies>
    <BaseTaxonomy items="464">http://fasb.org/us-gaap/2024</BaseTaxonomy>
    <BaseTaxonomy items="30">http://xbrl.sec.gov/dei/2024</BaseTaxonomy>
    <BaseTaxonomy items="37">http://xbrl.sec.gov/ecd/2024</BaseTaxonomy>
  </BaseTaxonomies>
  <HasPresentationLinkbase>false</HasPresentationLinkbase>
  <HasCalculationLinkbase>false</HasCalculationLinkbase>
</FilingSummary>
