Skip to content

Instantly share code, notes, and snippets.

View ScriptBytes's full-sized avatar

Jeff ScriptBytes

View GitHub Profile
@ScriptBytes
ScriptBytes / page.tsx
Created November 16, 2023 22:36
A working, but ugly, way to show JSON in a web page
'use client';
import React, { useEffect, useState } from 'react';
function JsonTester() {
const [json, setJson] = useState('');
useEffect(() => {
const getJson = async () => {
var response = await fetch('https://swapi.dev/api/people/1');
if (response.ok) {
setJson(JSON.stringify(await response.json()));