Przeczytaj plik JSON za pomocą JavaScript

Przeczytaj plik JSON za pomocą JavaScript

JSON oznacza Notacja obiektu JavaScript . Jest to sposób organizowania danych w pliku skryptu przy użyciu tekstu, ułatwiający przechowywanie i udostępnianie danych.

Czytanie JSON pliki, niezależnie od tego, czy są przechowywane lokalnie, czy na serwerze, mają kluczowe znaczenie dla aplikacji internetowych. W tym samouczku omówimy trzy metody odczytu plików JSON w JavaScript, które mogą być bardzo pomocne dla twórców stron internetowych.

Spis treści

NOTATKA: JavaScript obsługuje wewnętrznie JSON, więc nie wymaga dodatkowych modułów do importowania i wyświetlania JSON. Musimy tylko zaimportować plik JSON i możemy go łatwo użyć bezpośrednio do manipulacji na nim.

Jak odczytać plik JSON w JavaScript?

Trzy metody odczytu plików JSON w JavaScript to:

Notatka: Poniższy plik JSON zostanie użyty do pobrania danych.

przykładowy.json

{ 'users':[ { 'site':'techcodeview.com', 'user': 'Shobhit' } ] } 

1. Użycie funkcji API fetch() do odczytu pliku JSON

Metoda fetch() służy do odczytu plików JSON (plików lokalnych lub przesłanych). Używa tej samej składni dla obu typów plików.

Składnia

fetch('JSONFilePath').then().then().catch(); 

Wykonaj poniższe kroki, aby odczytać plik JSON przy użyciu metody fetch API:

  • Utwórz plik JSON i dodaj do niego dane
  • Otwórz plik JavaScript
  • W metodzie fetch podaj ścieżkę pliku JSON
  • Użyj metody .json(), aby przeanalizować dane w formacie JSON.
  • Wyświetl zawartość w konsoli.

Przykład odczytu pliku JSON w JavaScript:

Poniższy kod pomoże Ci zrozumieć użycie metody fetch() do odczytu plików JSON.

HTML
          Przeczytaj tytuł pliku JSON> head> <body>  <h1>techcodeview.comh1> <h3>Przejdź do konsoli, aby zobaczyć pobrane dane!! h3> <script>funkcja fetchJSONData() { fetch('./sample.json') .then((res) => { if (!res.ok) { wyrzuć nowy błąd (`Błąd HTTP! Status: ${res.status} `); } return res.json(); }) .then((dane) => konsola.log(dane)) .catch((błąd) => console.error('Nie można pobrać danych:', błąd));  } pobierzJSONData();  skrypt> treść> html> </pre>  </code>  <p dir='ltr'>  <b>  <strong>Wyjście: </strong>  </b>  </p>  <p dir='ltr'> <img src='//techcodeview.com/img/javascript-questions/49/read-json-file-using-javascript.webp' alt='widok konsoli danych JSON po pobraniu API'> </p>  <h2 id='using-the-require-module-to-read-json-file'>  <b>  <strong>2. Użycie modułu Require do odczytu pliku JSON </strong>  </b>  </h2> <p dir='ltr'>  <span>Wymagaj modułu </span>  <span>służy do włączania modułów do aplikacji. Można go użyć do dołączenia pliku do aplikacji internetowej. </span> </p>  <h3> <span>Składnia: </span> </h3> <pre>require(JSONFilePath); </pre> <p dir='ltr'> <span>Wykonaj poniższe kroki, aby odczytać pliki JSON przy użyciu wymaganego modułu w JavaScript. </span> </p>  <ul> <li value='1'> <span>Utwórz plik JSON zgodnie z opisem w poprzednim podejściu </span> </li> <li value='2'> <span>Utwórz skrypt.js i użyj wymaganej metody węzła, aby zaimportować plik JSON </span> </li> <li value='3'> <span>Wydrukuj dane na konsoli </span> </li> </ul> <p dir='ltr'>  <b>  <strong>NOTATKA: </strong>  </b>  <span>Zamiast uruchamiać program w przeglądarce, uruchomimy go na konsoli za pomocą Node. Upewnij się, że masz co najmniej wersję Node 17.0. </span> </p>  <h3>  <b>  <strong>Przykład </strong>  </b>  </h3> <p dir='ltr'> <span>Poniższy kod można wkleić bezpośrednio do pliku skryptu (musi być zainstalowany węzeł), aby wykonać i pobrać dane JSON. </span> </p>JavaScript <code>  <pre>const sample = require('./sample.json'); console.log(sample); </pre>  </code>  <p dir='ltr'>  <b>  <strong>Wyjście: </strong>  </b>  </p>  <pre>{ users: [ { site: 'GeeksForGeeks', user: 'Shobhit' } ] } </pre> <h2 id='by-importing-the-module-to-read-json-file'>  <b>  <strong>3. Importując moduł do odczytu pliku JSON </strong>  </b>  </h2> <p dir='ltr'> <span>The </span>  <span>oświadczenie importowe </span>  <span>można używać do importowania i przechowywania elementów pliku JSON w zmiennej w JavaScript. </span> </p>  <h3> <span>Składnia: </span> </h3> <pre>import nameOfVariable from 'JSONFilePath' assert {type: 'json'}; </pre> <ul> <li value='1'> <span>Utwórz plik JSON zgodnie z opisem w poprzednich przykładach. </span> </li> <li value='2'> <span>Utwórz plik script.js i zaimportuj plik JSON </span> </li> </ul> <h3>  <b>  <strong>Przykład odczytu pliku JSON w JavaScript: </strong>  </b>  </h3> <p dir='ltr'> <span>Poniższy kod odczytuje plik JSON, importując go za pomocą instrukcji import. </span> </p>HTML <code>  <pre>   <html lang='en'>  <head>  <meta charset='UTF-8'>  <meta name='viewport' content= 'width=device-width, initial-scale=1.0'>  <title>Przeczytaj tytuł pliku JSON> head> <body>  <h1>techcodeview.comh1> <h3>Przejdź do konsoli, aby zobaczyć pobrane dane!! h3> <script type='module' src='./script.js'>skrypt> treść> html> </pre>  </code>JavaScript <code>  <pre>// script.js import user from './sample.json' assert { type: 'json' }; console.log(user) </pre>  </code>  <p dir='ltr'>  <b>  <strong>Wyjście: </strong>  </b>  </p>  <p dir='ltr'> <img src='//techcodeview.com/img/javascript-questions/49/read-json-file-using-javascript.webp' alt='widok konsoli danych JSON przy użyciu modułu importu'> </p>  <h2 id='conclusion'> <span>Wniosek </span> </h2> <p dir='ltr'> <span>Odczytywanie plików JSON w JavaScript jest bardzo ważnym zadaniem dla twórcy stron internetowych, ponieważ pliki JSON służą do przechowywania danych użytkownika, danych konfiguracyjnych, danych statycznych i innych ważnych informacji. </span> </p>  <p dir='ltr'> <span>W tym przewodniku za pomocą przykładów wyjaśniono trzy metody odczytu plików JSON w JavaScript. Rozumiejąc te techniki, programiści mogą śmiało radzić sobie z zadaniami związanymi z plikami JSON, zapewniając płynniejsze procesy programowania i lepsze doświadczenia użytkowników. </span> </p>  <br>  <br>
                     </div>

                     <!-- Article Footer with Prominent Share Buttons -->
                     <div class="px-6 md:px-8 py-8 bg-slate-50 dark:bg-slate-900/50 border-t border-slate-200 dark:border-slate-700/50">
                          <div class="flex flex-col sm:flex-row items-center justify-between gap-6">
                              <h4 class="text-base font-bold text-slate-700 dark:text-slate-300 uppercase tracking-wide flex items-center gap-2">
                                 <i class="fa fa-share-alt text-tech-500"> </i>
                                Udział                              </h4>
                             
                              <div class="flex flex-wrap justify-center gap-3">
                                 <!-- Twitter -->
                                 <a href="https://twitter.com/intent/tweet?text=Przeczytaj plik JSON za pomocą JavaScript&url=https://www.techcodeview.com/pl/read-json-file-using-javascript" 
                                   target="_blank" rel="noopener noreferrer" 
                                   class="flex items-center gap-2 px-6 py-3 rounded-xl bg-[#1DA1F2]/10 text-[#1DA1F2] hover:bg-[#1DA1F2] hover:text-white transition-all duration-300 font-bold text-sm">
                                     <i class="fa fa-twitter text-lg"> </i>
                                     <span class="hidden sm:inline">Twitter </span>
                                 </a>

                                 <!-- Facebook -->
                                 <a href="https://www.facebook.com/sharer/sharer.php?u=https://www.techcodeview.com/pl/read-json-file-using-javascript" 
                                   target="_blank" rel="noopener noreferrer"
                                   class="flex items-center gap-2 px-6 py-3 rounded-xl bg-[#4267B2]/10 text-[#4267B2] hover:bg-[#4267B2] hover:text-white transition-all duration-300 font-bold text-sm">
                                     <i class="fa fa-facebook text-lg"> </i>
                                     <span class="hidden sm:inline">Facebook </span>
                                 </a>
                                
                                 <!-- LinkedIn -->
                                 <a href="https://www.linkedin.com/shareArticle?mini=true&url=https://www.techcodeview.com/pl/read-json-file-using-javascript&title=Przeczytaj plik JSON za pomocą JavaScript" 
                                   target="_blank" rel="noopener noreferrer"
                                   class="flex items-center gap-2 px-6 py-3 rounded-xl bg-[#0077b5]/10 text-[#0077b5] hover:bg-[#0077b5] hover:text-white transition-all duration-300 font-bold text-sm">
                                     <i class="fa fa-linkedin text-lg"> </i>
                                     <span class="hidden sm:inline">LinkedIn </span>
                                 </a>
                              </div>
                          </div>
                     </div>
                </article>

                <!-- Comments Placeholder / Random Articles -->
                <div class="mt-8 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-xl p-6 md:p-8 shadow-sm">
                     <h3 class="text-xl font-bold text-slate-900 dark:text-white mb-6 uppercase tracking-wide border-b border-slate-200 dark:border-slate-700 pb-2">
                        Może Ci Się Spodobać                     </h3>
                     <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                         <div class="group">
                              <a href="/pl/us-state-capitals-list" class="block aspect-video rounded-lg overflow-hidden bg-slate-200 dark:bg-slate-700 mb-3">
                                 <img loading="lazy" src="https://techcodeview.com/img/picked/88/us-state-capitals-list.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Lista stolic stanów USA" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500">
                              </a>
                              <h4 class="font-bold text-slate-900 dark:text-white leading-tight group-hover:text-tech-500 transition-colors">
                                 <a href="/pl/us-state-capitals-list">Lista stolic stanów USA </a>
                              </h4>
                         </div> <div class="group">
                              <a href="/pl/java-chararraywriter-class-set-2" class="block aspect-video rounded-lg overflow-hidden bg-slate-200 dark:bg-slate-700 mb-3">
                                 <img loading="lazy" src="https://techcodeview.com/img/java/28/java-chararraywriter-class-set-2.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Klasa Java CharArrayWriter | Zestaw 2" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500">
                              </a>
                              <h4 class="font-bold text-slate-900 dark:text-white leading-tight group-hover:text-tech-500 transition-colors">
                                 <a href="/pl/java-chararraywriter-class-set-2">Klasa Java CharArrayWriter | Zestaw 2 </a>
                              </h4>
                         </div>
                     </div>
                </div>
             </div>

             <!-- SECONDARY COLUMN (SIDEBAR) -->
             <!-- Aside Column -->
 <div class="lg:col-span-4 space-y-8">
	
	 <!-- Best Articles Widget -->
	 <div class="rounded-xl bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 p-6 shadow-sm">
		 <div class="mb-4 border-b border-slate-100 dark:border-slate-700 pb-2">
			 <h2 class="text-lg font-bold text-slate-900 dark:text-white uppercase tracking-wide flex items-center">
                 <span class="mr-2 h-2 w-2 rounded-full bg-tech-500"> </span>
                Najpopularniejsze Artykuły             </h2>
		 </div>
		
		 <!-- Owl Carousel Preserved Container -->
		 <div id="owl-carousel-3" class="owl-carousel owl-theme center-owl-nav">
			 <!-- ARTICLE -->
			 <article class="flex items-start gap-4 p-2 hover:bg-slate-50 dark:hover:bg-slate-700/50 rounded-lg transition-colors">
				 <div class="w-20 h-20 shrink-0 overflow-hidden rounded-md bg-slate-200 dark:bg-slate-700">
					 <a href="/pl/rxjs-observables">
						 <img src="https://techcodeview.com/img/rxjs-tutorial/49/rxjs-observables.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Obserwowalne RxJS" class="w-full h-full object-cover">
					 </a>
				 </div>
				 <div class="flex-1 min-w-0">
					 <h4 class="text-sm font-semibold text-slate-800 dark:text-slate-200 leading-snug">
                         <a href="/pl/rxjs-observables" class="hover:text-tech-500 transition-colors line-clamp-3">Obserwowalne RxJS </a>
                     </h4>
				 </div>
			 </article>
			 <!-- /ARTICLE --> <!-- ARTICLE -->
			 <article class="flex items-start gap-4 p-2 hover:bg-slate-50 dark:hover:bg-slate-700/50 rounded-lg transition-colors">
				 <div class="w-20 h-20 shrink-0 overflow-hidden rounded-md bg-slate-200 dark:bg-slate-700">
					 <a href="/pl/what-is-full-form-cmd">
						 <img src="https://techcodeview.com/img/category/31/what-is-full-form-cmd.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Jaka jest pełna forma CMD" class="w-full h-full object-cover">
					 </a>
				 </div>
				 <div class="flex-1 min-w-0">
					 <h4 class="text-sm font-semibold text-slate-800 dark:text-slate-200 leading-snug">
                         <a href="/pl/what-is-full-form-cmd" class="hover:text-tech-500 transition-colors line-clamp-3">Jaka jest pełna forma CMD </a>
                     </h4>
				 </div>
			 </article>
			 <!-- /ARTICLE --> <!-- ARTICLE -->
			 <article class="flex items-start gap-4 p-2 hover:bg-slate-50 dark:hover:bg-slate-700/50 rounded-lg transition-colors">
				 <div class="w-20 h-20 shrink-0 overflow-hidden rounded-md bg-slate-200 dark:bg-slate-700">
					 <a href="/pl/best-summary-analysis-131628">
						 <img src="https://techcodeview.com/img/blog/46/best-summary-analysis.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Najlepsze podsumowanie i analiza: Wielki Gatsby, rozdział 8" class="w-full h-full object-cover">
					 </a>
				 </div>
				 <div class="flex-1 min-w-0">
					 <h4 class="text-sm font-semibold text-slate-800 dark:text-slate-200 leading-snug">
                         <a href="/pl/best-summary-analysis-131628" class="hover:text-tech-500 transition-colors line-clamp-3">Najlepsze podsumowanie i analiza: Wielki Gatsby, rozdział 8 </a>
                     </h4>
				 </div>
			 </article>
			 <!-- /ARTICLE --> <!-- ARTICLE -->
			 <article class="flex items-start gap-4 p-2 hover:bg-slate-50 dark:hover:bg-slate-700/50 rounded-lg transition-colors">
				 <div class="w-20 h-20 shrink-0 overflow-hidden rounded-md bg-slate-200 dark:bg-slate-700">
					 <a href="/pl/canceled-cancelled-which-one-is-correct">
						 <img src="https://techcodeview.com/img/banking-english/73/canceled-cancelled-which-one-is-correct.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Anulowane czy anulowane – który jest poprawny?" class="w-full h-full object-cover">
					 </a>
				 </div>
				 <div class="flex-1 min-w-0">
					 <h4 class="text-sm font-semibold text-slate-800 dark:text-slate-200 leading-snug">
                         <a href="/pl/canceled-cancelled-which-one-is-correct" class="hover:text-tech-500 transition-colors line-clamp-3">Anulowane czy anulowane – który jest poprawny? </a>
                     </h4>
				 </div>
			 </article>
			 <!-- /ARTICLE --> <!-- ARTICLE -->
			 <article class="flex items-start gap-4 p-2 hover:bg-slate-50 dark:hover:bg-slate-700/50 rounded-lg transition-colors">
				 <div class="w-20 h-20 shrink-0 overflow-hidden rounded-md bg-slate-200 dark:bg-slate-700">
					 <a href="/pl/javascript-certification-free">
						 <img src="https://techcodeview.com/img/javascript-tutorial/52/javascript-certification-free.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Certyfikat JavaScript za darmo" class="w-full h-full object-cover">
					 </a>
				 </div>
				 <div class="flex-1 min-w-0">
					 <h4 class="text-sm font-semibold text-slate-800 dark:text-slate-200 leading-snug">
                         <a href="/pl/javascript-certification-free" class="hover:text-tech-500 transition-colors line-clamp-3">Certyfikat JavaScript za darmo </a>
                     </h4>
				 </div>
			 </article>
			 <!-- /ARTICLE --> <!-- ARTICLE -->
			 <article class="flex items-start gap-4 p-2 hover:bg-slate-50 dark:hover:bg-slate-700/50 rounded-lg transition-colors">
				 <div class="w-20 h-20 shrink-0 overflow-hidden rounded-md bg-slate-200 dark:bg-slate-700">
					 <a href="/pl/difference-between-local-storage">
						 <img src="https://techcodeview.com/img/blogathon-2021/12/difference-between-local-storage.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Różnica między przechowywaniem lokalnym, przechowywaniem sesji i plikami cookie" class="w-full h-full object-cover">
					 </a>
				 </div>
				 <div class="flex-1 min-w-0">
					 <h4 class="text-sm font-semibold text-slate-800 dark:text-slate-200 leading-snug">
                         <a href="/pl/difference-between-local-storage" class="hover:text-tech-500 transition-colors line-clamp-3">Różnica między przechowywaniem lokalnym, przechowywaniem sesji i plikami cookie </a>
                     </h4>
				 </div>
			 </article>
			 <!-- /ARTICLE --> <!-- ARTICLE -->
			 <article class="flex items-start gap-4 p-2 hover:bg-slate-50 dark:hover:bg-slate-700/50 rounded-lg transition-colors">
				 <div class="w-20 h-20 shrink-0 overflow-hidden rounded-md bg-slate-200 dark:bg-slate-700">
					 <a href="/pl/sql-server-describe-table">
						 <img src="https://techcodeview.com/img/sql-server-tutorials/64/sql-server-describe-table.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Tabela opisu serwera SQL" class="w-full h-full object-cover">
					 </a>
				 </div>
				 <div class="flex-1 min-w-0">
					 <h4 class="text-sm font-semibold text-slate-800 dark:text-slate-200 leading-snug">
                         <a href="/pl/sql-server-describe-table" class="hover:text-tech-500 transition-colors line-clamp-3">Tabela opisu serwera SQL </a>
                     </h4>
				 </div>
			 </article>
			 <!-- /ARTICLE --> <!-- ARTICLE -->
			 <article class="flex items-start gap-4 p-2 hover:bg-slate-50 dark:hover:bg-slate-700/50 rounded-lg transition-colors">
				 <div class="w-20 h-20 shrink-0 overflow-hidden rounded-md bg-slate-200 dark:bg-slate-700">
					 <a href="/pl/how-calculate-psat-score-131840">
						 <img src="https://techcodeview.com/img/blog/74/how-calculate-psat-score.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Jak obliczyć wynik PSAT: 3-etapowy kalkulator wyniku" class="w-full h-full object-cover">
					 </a>
				 </div>
				 <div class="flex-1 min-w-0">
					 <h4 class="text-sm font-semibold text-slate-800 dark:text-slate-200 leading-snug">
                         <a href="/pl/how-calculate-psat-score-131840" class="hover:text-tech-500 transition-colors line-clamp-3">Jak obliczyć wynik PSAT: 3-etapowy kalkulator wyniku </a>
                     </h4>
				 </div>
			 </article>
			 <!-- /ARTICLE --> <!-- ARTICLE -->
			 <article class="flex items-start gap-4 p-2 hover:bg-slate-50 dark:hover:bg-slate-700/50 rounded-lg transition-colors">
				 <div class="w-20 h-20 shrink-0 overflow-hidden rounded-md bg-slate-200 dark:bg-slate-700">
					 <a href="/pl/introduction-directed-acyclic-graph">
						 <img src="https://techcodeview.com/img/it-problems-solutions/39/introduction-directed-acyclic-graph.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Wprowadzenie do skierowanego grafu acyklicznego" class="w-full h-full object-cover">
					 </a>
				 </div>
				 <div class="flex-1 min-w-0">
					 <h4 class="text-sm font-semibold text-slate-800 dark:text-slate-200 leading-snug">
                         <a href="/pl/introduction-directed-acyclic-graph" class="hover:text-tech-500 transition-colors line-clamp-3">Wprowadzenie do skierowanego grafu acyklicznego </a>
                     </h4>
				 </div>
			 </article>
			 <!-- /ARTICLE --> <!-- ARTICLE -->
			 <article class="flex items-start gap-4 p-2 hover:bg-slate-50 dark:hover:bg-slate-700/50 rounded-lg transition-colors">
				 <div class="w-20 h-20 shrink-0 overflow-hidden rounded-md bg-slate-200 dark:bg-slate-700">
					 <a href="/pl/time-command-linux-with-examples">
						 <img src="https://techcodeview.com/img/linux-command/88/time-command-linux-with-examples.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="polecenie time w systemie Linux z przykładami" class="w-full h-full object-cover">
					 </a>
				 </div>
				 <div class="flex-1 min-w-0">
					 <h4 class="text-sm font-semibold text-slate-800 dark:text-slate-200 leading-snug">
                         <a href="/pl/time-command-linux-with-examples" class="hover:text-tech-500 transition-colors line-clamp-3">polecenie time w systemie Linux z przykładami </a>
                     </h4>
				 </div>
			 </article>
			 <!-- /ARTICLE -->
		 </div>
		

         <!-- Categories -->
		 <div class="mt-8 mb-4 border-b border-slate-100 dark:border-slate-700 pb-2">
			 <h2 class="text-lg font-bold text-slate-900 dark:text-white uppercase tracking-wide">Kategoria </h2>
		 </div>
		 <div class="flex flex-wrap gap-2">
             <a href="/pl/blog/" class="inline-block px-3 py-1 bg-slate-100 dark:bg-slate-700 text-xs font-medium text-slate-600 dark:text-slate-300 rounded-full hover:bg-tech-500 hover:text-white transition-colors">
                Blog
             </a> <a href="/pl/java-conversion/" class="inline-block px-3 py-1 bg-slate-100 dark:bg-slate-700 text-xs font-medium text-slate-600 dark:text-slate-300 rounded-full hover:bg-tech-500 hover:text-white transition-colors">
                Konwersja Javy
             </a> <a href="/pl/maths/" class="inline-block px-3 py-1 bg-slate-100 dark:bg-slate-700 text-xs font-medium text-slate-600 dark:text-slate-300 rounded-full hover:bg-tech-500 hover:text-white transition-colors">
                Matematyka
             </a> <a href="/pl/java-collections/" class="inline-block px-3 py-1 bg-slate-100 dark:bg-slate-700 text-xs font-medium text-slate-600 dark:text-slate-300 rounded-full hover:bg-tech-500 hover:text-white transition-colors">
                Kolekcje Javy
             </a> <a href="/pl/differences/" class="inline-block px-3 py-1 bg-slate-100 dark:bg-slate-700 text-xs font-medium text-slate-600 dark:text-slate-300 rounded-full hover:bg-tech-500 hover:text-white transition-colors">
                Różnice
             </a> <a href="/pl/java-string/" class="inline-block px-3 py-1 bg-slate-100 dark:bg-slate-700 text-xs font-medium text-slate-600 dark:text-slate-300 rounded-full hover:bg-tech-500 hover:text-white transition-colors">
                Ciąg Java
             </a>
         </div>

         <!-- Interesting Articles Widget -->
		 <div class="mt-8">
			 <div class="mb-4 border-b border-slate-100 dark:border-slate-700 pb-2">
				 <h2 class="text-lg font-bold text-slate-900 dark:text-white uppercase tracking-wide">Ciekawe Artykuły </h2>
			 </div>
			
			 <div id="owl-carousel-4" class="owl-carousel owl-theme">
				 <!-- ARTICLE -->
				 <article class="relative aspect-video rounded-lg overflow-hidden group mb-2">
					 <div class="absolute inset-0">
						 <img src="https://techcodeview.com/img/general-knowledge-questions/33/what-is-national-game-usa.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Czym jest gra narodowa USA? Sport w Ameryce" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500">
                         <div class="absolute inset-0 bg-gradient-to-t from-black/80 to-transparent"> </div>
					 </div>
					 <div class="absolute bottom-0 left-0 p-4">
						 <div class="text-xs text-tech-400 font-bold mb-1"> <a href="/pl/general-knowledge-questions/">Pytania-Z Wiedzy Ogólnej </a> </div>
						 <h4 class="text-sm font-bold text-white leading-tight"> <a href="/pl/what-is-national-game-usa">Czym jest gra narodowa USA? Sport w Ameryce </a> </h4>
					 </div>
				 </article>
				 <!-- /ARTICLE --> <!-- ARTICLE -->
				 <article class="relative aspect-video rounded-lg overflow-hidden group mb-2">
					 <div class="absolute inset-0">
						 <img src="https://techcodeview.com/img/digital-electronics-logic-gate/81/nand-gate.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Brama NAND" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500">
                         <div class="absolute inset-0 bg-gradient-to-t from-black/80 to-transparent"> </div>
					 </div>
					 <div class="absolute bottom-0 left-0 p-4">
						 <div class="text-xs text-tech-400 font-bold mb-1"> <a href="/pl/digital-electronics-logic-gate/">Elektronika Cyfrowa - Bramka Logiczna </a> </div>
						 <h4 class="text-sm font-bold text-white leading-tight"> <a href="/pl/nand-gate">Brama NAND </a> </h4>
					 </div>
				 </article>
				 <!-- /ARTICLE --> <!-- ARTICLE -->
				 <article class="relative aspect-video rounded-lg overflow-hidden group mb-2">
					 <div class="absolute inset-0">
						 <img src="https://techcodeview.com/img/java-tutorial/86/java-tuple.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Krotka Java" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500">
                         <div class="absolute inset-0 bg-gradient-to-t from-black/80 to-transparent"> </div>
					 </div>
					 <div class="absolute bottom-0 left-0 p-4">
						 <div class="text-xs text-tech-400 font-bold mb-1"> <a href="/pl/java-tutorial/">Samouczek Java </a> </div>
						 <h4 class="text-sm font-bold text-white leading-tight"> <a href="/pl/java-tuple">Krotka Java </a> </h4>
					 </div>
				 </article>
				 <!-- /ARTICLE --> <!-- ARTICLE -->
				 <article class="relative aspect-video rounded-lg overflow-hidden group mb-2">
					 <div class="absolute inset-0">
						 <img src="https://techcodeview.com/img/best/47/best-movies-watch-with-friends.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Najlepsze filmy do oglądania z przyjaciółmi" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500">
                         <div class="absolute inset-0 bg-gradient-to-t from-black/80 to-transparent"> </div>
					 </div>
					 <div class="absolute bottom-0 left-0 p-4">
						 <div class="text-xs text-tech-400 font-bold mb-1"> <a href="/pl/best/">To, Co Najlepsze </a> </div>
						 <h4 class="text-sm font-bold text-white leading-tight"> <a href="/pl/best-movies-watch-with-friends">Najlepsze filmy do oglądania z przyjaciółmi </a> </h4>
					 </div>
				 </article>
				 <!-- /ARTICLE --> <!-- ARTICLE -->
				 <article class="relative aspect-video rounded-lg overflow-hidden group mb-2">
					 <div class="absolute inset-0">
						 <img src="https://techcodeview.com/img/javascript-basics/37/javascript-loop.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="JavaScript dla pętli" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500">
                         <div class="absolute inset-0 bg-gradient-to-t from-black/80 to-transparent"> </div>
					 </div>
					 <div class="absolute bottom-0 left-0 p-4">
						 <div class="text-xs text-tech-400 font-bold mb-1"> <a href="/pl/javascript-basics/">Podstawy Javascript </a> </div>
						 <h4 class="text-sm font-bold text-white leading-tight"> <a href="/pl/javascript-loop">JavaScript dla pętli </a> </h4>
					 </div>
				 </article>
				 <!-- /ARTICLE --> <!-- ARTICLE -->
				 <article class="relative aspect-video rounded-lg overflow-hidden group mb-2">
					 <div class="absolute inset-0">
						 <img src="https://techcodeview.com/img/linux-tutorial/57/linux-package-manager.webp" onerror="this.onerror=null; this.src='https://techcodeview.com/template/assets/images/unnamed.webp'" alt="Menedżer pakietów Linuksa" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500">
                         <div class="absolute inset-0 bg-gradient-to-t from-black/80 to-transparent"> </div>
					 </div>
					 <div class="absolute bottom-0 left-0 p-4">
						 <div class="text-xs text-tech-400 font-bold mb-1"> <a href="/pl/linux-tutorial/">Samouczek Linuksa </a> </div>
						 <h4 class="text-sm font-bold text-white leading-tight"> <a href="/pl/linux-package-manager">Menedżer pakietów Linuksa </a> </h4>
					 </div>
				 </article>
				 <!-- /ARTICLE -->
			 </div>
		 </div>
	 </div>
 </div>
 <!-- /Aside Column -->         </div>
        </div>
     </div>

 <footer class="site-footer">
         <div class="container">
             <span class="footer-links">
                Copyright ©2026 Wszelkie Prawa Zastrzeżone | 
                 <a href="//www.techcodeview.com/lv/">techcodeview.com </a> | 
                 <a href="/disclaimer" rel="nofollow noopener noreferrer" target="_blank">Zastrzeżenie </a> | 
                 <a href="/about-us" rel="nofollow noopener noreferrer" target="_blank">O Nas </a> | 
                 <a href="/privacy-policy" rel="nofollow noopener noreferrer" target="_blank">Polityka Prywatności </a> 
             </span>
         </div>
     </footer>
 
     <script type="text/javascript" src="https://techcodeview.com/template/assets/plugins/jquery-1.11.3.min.js"> </script>
     <script type="text/javascript" src="https://techcodeview.com/template/assets/plugins/bootstrap/js/bootstrap.min.js"> </script>    
     <script type="text/javascript" src="https://techcodeview.com/template/assets/js/main.js"> </script>     
	 <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/highlight.min.js"> </script>
	 <script>
    !function(){"use strict";let t=document.createElement("button");t.id="toTopBtn",t.innerHTML="↑";let e=`
        #toTopBtn {
            position: fixed; bottom: 25px; right: 25px; z-index: 9999; opacity: 0; visibility: hidden; background-color: #0ea5e9; color: white; border: none; border-radius: 8px; width: 50px; height: 50px; font-size: 24px; cursor: pointer; transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
        }
        #toTopBtn:hover { background-color: #0284c7; }
    `,i=document.createElement("style");i.type="text/css",i.innerText=e,document.head.appendChild(i),document.body.appendChild(t),window.addEventListener("scroll",()=>{let e=window.scrollY||document.documentElement.scrollTop;e>300?(t.style.opacity="1",t.style.visibility="visible"):(t.style.opacity="0",t.style.visibility="hidden")}),t.addEventListener("click",()=>{window.scrollTo({top:0,behavior:"smooth"})})}();
     </script>
 </body>
 </html>