請 ChatGPT 幫忙出 JSON 的練習題,作業,面試考題

萬能的 ChatGPT 大大可以幫我們做出各式各樣的 JSON,適合初學者練習 JSON 的解析,也適合老師或公司出作業和面試考題,接下來讓我們看看各種有趣的例子吧。

ps: 當 JSON 太長無法一次回答時,請再輸入 continue ,ChatGPT 會耐心地繼續回答的。

  • 用 JSON 建立台灣縣市的 array,寫中文,JSON 的第一層是 array
  • show me a JSON example about six disneylands
  • show me a JSON example about Steve Jobs
  • show me a JSON example about movies
  • show me a JSON example about WWDC
  • show me a JSON example about 遊戲斯普拉遁3,資料以中文呈現
  • 定義選擇題的 JSON,題目跟哈利波特有關,用中文表示資料
  • 定義選擇題的 JSON,JSON 的第一層是 array,題目跟哈利波特有關,用中文表示資料
  • 先產生 swift 定義的 array,再產生 JSON

用 JSON 建立台灣縣市的 array,寫中文,JSON 的第一層是 array

回答 1

["台北",  "新北",  "桃園",  "台中",  "台南",  "高雄",  "基隆",  "新竹",  "苗栗",  "雲林",  "嘉義",  "嘉義縣",  "屏東",  "宜蘭",  "花蓮",  "台東",  "南投",  "苗栗",  "新竹縣",  "金門",  "連江"]

回答 2

{
"name": "台灣縣市",
"type": "array",
"data": [
"基隆市",
"臺北市",
"新北市",
"桃園市",
"新竹市",
"新竹縣",
"苗栗縣",
"臺中市",
"彰化縣",
"南投縣",
"雲林縣",
"嘉義市",
"嘉義縣",
"臺南市",
"高雄市",
"屏東縣",
"宜蘭縣",
"花蓮縣",
"臺東縣",
"澎湖縣",
"金門縣",
"連江縣"
]
}

show me a JSON example about six disneylands

{
"id": "disneylands",
"name": "Disneylands",
"disneylands": [
{
"name": "Disneyland Park",
"location": "Anaheim, California, USA",
"year_opened": "1955",
"description": "Disneyland Park, originally Disneyland, is the first of two theme parks built at the Disneyland Resort in Anaheim, California, opened on July 17, 1955. It is the only theme park designed and built under the direct supervision of Walt Disney."
},
{
"name": "Disneyland Paris",
"location": "Marne-la-Vallée, France",
"year_opened": "1992",
"description": "Disneyland Paris, originally Euro Disneyland, is an entertainment resort in Marne-la-Vallée, a new town located 32 km east of the centre of Paris. It is the most visited theme park in Europe and was the second Disney park to open outside the United States."
},
{
"name": "Hong Kong Disneyland",
"location": "Lantau Island, Hong Kong",
"year_opened": "2005",
"description": "Hong Kong Disneyland is a theme park located on reclaimed land in Pennys Bay, Lantau Island. It is the first theme park located inside the Hong Kong Disneyland Resort and is owned and managed by Hong Kong International Theme Parks."
},
{
"name": "Shanghai Disneyland",
"location": "Pudong, Shanghai, China",
"year_opened": "2016",
"description": "Shanghai Disneyland is a theme park located in Pudong, Shanghai, China. It is the first Disney park resort in mainland China and the second in China, after the Hong Kong Disneyland Resort. The resort is operated by Shanghai Shendi Group, a joint venture of The Walt Disney Company and Shanghai Alliance Investment."
},
{
"name": "Tokyo Disneyland",
"location": "Urayasu, Chiba, Japan",
"year_opened": "1983",
"description": "Tokyo Disneyland is a theme park located in Urayasu, Chiba, Japan, near Tokyo. It is owned and operated by the Oriental Land Company with a license from The Walt Disney Company. Tokyo Disneyland and its companion park, Tokyo DisneySea, are the only Disney parks not owned by The Walt Disney Company."
},
{
"name": "Disneyland Resort",
"location": "Sydney, New South Wales, Australia",
"year_opened": "1995",
"description": "The Disneyland Resort, commonly known as Disneyland, is an entertainment resort in Sydney, New South Wales, Australia. It is the only Disney park resort in Australia and includes a theme park, the Disney's Hollywood Studios, and a water park, Typhoon Lagoon."
}
]
}

show me a JSON example about Steve Jobs

{
"id": "steve-jobs",
"name": "Steve Jobs",
"born": "February 24, 1955",
"died": "October 5, 2011",
"description": "Steve Jobs was an American entrepreneur and business magnate who was the co-founder, CEO, and chairman of Apple Inc. He was a pioneer of the personal computer revolution and helped to develop the Macintosh, iPod, iPhone, and iPad. Jobs was also a co-founder of Pixar Animation Studios and served as the CEO of Pixar and Disney Animation Studios.",
"education": [
{
"institution": "Reed College",
"degree": "None",
"field_of_study": "Literature and Poetry",
"year": "1972-1974"
}
],
"career": [
{
"company": "Apple Inc.",
"title": "Co-founder and CEO",
"description": "Co-founded Apple Inc. and served as the company's CEO from 1976 to 1985, then again from 1997 to 2011.",
"start_date": "1976",
"end_date": "2011"
},
{
"company": "NeXT Inc.",
"title": "Founder and CEO",
"description": "Founded NeXT Inc. and served as the company's CEO from 1985 to 1996.",
"start_date": "1985",
"end_date": "1996"
},
{
"company": "Pixar Animation Studios",
"title": "Co-founder and CEO",
"description": "Co-founded Pixar Animation Studios and served as the company's CEO from 1986 to 2006.",
"start_date": "1986",
"end_date": "2006"
},
{
"company": "Disney Animation Studios",
"title": "CEO",
"description": "Served as the CEO of Disney Animation Studios from 2006 to 2011.",
"start_date": "2006",
"end_date": "2011"
}
]
}

show me a JSON example about movies

[
{
"title": "The Shawshank Redemption",
"year": 1994,
"rated": "R",
"released": "14 Oct 1994",
"runtime": "142 min",
"genre": ["Crime", "Drama"],
"director": "Frank Darabont",
"writer": ["Stephen King", "Frank Darabont"],
"actors": ["Tim Robbins", "Morgan Freeman", "Bob Gunton"],
"plot": "Two imprisoned men bond over a number of years, finding solace and eventual redemption through acts of common decency.",
"language": ["English", "Latin"],
"country": "USA",
"awards": "Nominated for 7 Oscars. Another 19 wins & 30 nominations.",
"poster": "https://m.media-amazon.com/images/M/MV5BMDFkYTc0MGEtZmNhMC00ZDIzLWFmNTEtODM1ZmRlYWMwMWFmXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_SX300.jpg",
"ratings": [
{
"source": "Internet Movie Database",
"value": "9.3/10"
},
{
"source": "Rotten Tomatoes",
"value": "91%"
},
{
"source": "Metacritic",
"value": "80/100"
}
],
"metascore": "80",
"imdbRating": "9.3",
"imdbVotes": "2,158,836",
"imdbID": "tt0111161",
"type": "movie",
"dvd": "23 Jan 1996",
"boxOffice": "$28.34M",
"production": "Columbia Pictures",
"website": "http://www.shawshank.com/"
},
{
"title": "The Godfather",
"year": 1972,
"rated": "R",
"released": "24 Mar 1972",
"runtime": "175 min",
"genre": ["Crime", "Drama"],
"director": "Francis Ford Coppola",
"writer": ["Mario Puzo", "Francis Ford Coppola"],
"actors": ["Marlon Brando", "Al Pacino", "James Caan"],
"plot": "The aging patriarch of an organized crime dynasty transfers control of his clandestine empire to his reluctant son.",
"language": ["English", "Italian", "Latin"],
"country": "USA",
"awards": "Won 3 Oscars. Another 24 wins & 28 nominations.",
"poster": "https://m.media-amazon.com/images/M/MV5BM2MyNjYxNmUtYTAwNi00MTYxLWJmNWYtYzZlODY3ZTk3OTFlXkEyXkFqcGdeQXVyNzkwMjQ5NzM@._V1_SX300.jpg",
"ratings": [
{
"source": "Internet Movie Database",
"value": "9.2/10"
},
{
"source": "Rotten Tomatoes",
"value": "98%"
},
{
"source": "Metacritic",
"value": "100/100"
}
],
"metascore": "100",
"imdbRating": "9.2",
"imdbVotes": "1,808,146",
"imdbID": "tt0068646",
"type": "movie",
"dvd": "09 Oct 2001",
"boxOffice": "N/A",
"production": "Paramount Pictures",
"website": "http://www.thegodfather.com"
},
{
"title": "The Godfather: Part II",
"year": 1974,
"rated": "R",
"released": "20 Dec 1974",
"runtime": "202 min",
"genre": ["Crime", "Drama"],
"director": "Francis Ford Coppola",
"writer": ["Mario Puzo", "Francis Ford Coppola"],
"actors": ["Al Pacino", "Robert De Niro", "Robert Duvall"],
"plot": "The early life and career of Vito Corleone in 1920s New York is portrayed while his son, Michael, expands and tightens his grip on the family crime syndicate.",
"language": ["English", "Italian", "Spanish"],
"country": "USA",
"awards": "Won 6 Oscars. Another 17 wins & 19 nominations.",
"poster": "https://m.media-amazon.com/images/M/MV5BMWMwMGQzZTItY2JlNC00OWZiLWIyMDitNDRiNDQtZDQ2NjJmMDEyMjFlXkEyXkFqcGdeQXVyNzkwMjQ5NzM@._V1_SX300.jpg",
"ratings": [
{
"source": "Internet Movie Database",
"value": "9.0/10"
},
{
"source": "Rotten Tomatoes",
"value": "97%"
},
{
"source": "Metacritic",
"value": "90/100"
}
],
"metascore": "90",
"imdbRating": "9.0",
"imdbVotes": "1,323,045",
"imdbID": "tt0071562",
"type": "movie",
"dvd": "09 Oct 2001",
"boxOffice": "N/A",
"production": "Paramount Pictures",
"website": "http://www.thegodfather.com"
}
]

show me a JSON example about WWDC

{
"id": "wwdc2022",
"name": "WWDC 2022",
"date": "June 5-9, 2022",
"location": "San Jose, California, USA",
"description": "WWDC 2022 brings together the world's most innovative and creative developers. Get hands-on with the latest technologies, learn from Apple experts, and connect with fellow developers from around the world.",
"sessions": [
{
"id": "wwdc2022-1",
"title": "Introducing iOS 15",
"description": "Join the iOS team as they unveil the latest advancements in iOS and discuss new features and capabilities coming in iOS 15.",
"date": "June 5, 2022",
"time": "10:00am"
},
{
"id": "wwdc2022-2",
"title": "Building Augmented Reality Experiences with ARKit",
"description": "Learn how to create incredible AR experiences with the latest features in ARKit. Discover new tools and techniques for tracking, rendering, and interactivity.",
"date": "June 6, 2022",
"time": "1:00pm"
},
{
"id": "wwdc2022-3",
"title": "Designing for MacOS Monterey",
"description": "Explore the new design features and capabilities of MacOS Monterey and learn how to create beautiful, engaging Mac apps that take advantage of the latest technologies.",
"date": "June 7, 2022",
"time": "9:00am"
}
]
}

show me a JSON example about 遊戲斯普拉遁3,資料以中文呈現

{
"id": "spyder3-game",
"name": "斯普拉遁3(遊戲)",
"year": "2018",
"platform": "PlayStation 4, Xbox One, PC",
"genre": "動作冒險",
"description": "斯普拉遁3(遊戲)是一款由暴雪娛樂開發並由育碧藝術出版的動作冒險遊戲。遊戲繼承了電影《斯普拉遁3》的故事背景,玩家將扮演丹尼·斯普拉遁,在遊戲中探索各種地區,完成各種任務,並面對各種危險和敵人。",
"features": [
"豐富的冒險任務和挑戰",
"多種武器和道具可供選擇",
"各種敵人和 boss 戰",
"精美的 3D 地圖和環境"
]
}

定義選擇題的 JSON,題目跟哈利波特有關,用中文表示資料

{
"question": "哈利波特是哪一部小說中的主人公?",
"choices": [
"《哈利波特與魔法石》",
"《哈利波特與密室》",
"《哈利波特與火盃》",
"《哈利波特與消失的密室》"
],
"answer": 0
}

定義選擇題的 JSON,JSON 的第一層是 array,題目跟哈利波特有關,用中文表示資料

[
{
"question": "哈利波特的爸爸叫什麼名字?",
"options": [
"賈梅爾",
"伊恩",
"馬修",
"雷"
],
"answer": "賈梅爾"
},
{
"question": "哈利波特第一次獲得赫敏的信件是在什麼時候?",
"options": [
"十一歲生日前夕",
"十二歲生日前夕",
"十三歲生日前夕",
"十四歲生日前夕"
],
"answer": "十一歲生日前夕"
}
]

先產生 swift 定義的 array,再產生 JSON

--

--

彼得潘的 iOS App Neverland
彼得潘的 Swift iOS App 開發問題解答集

彼得潘的iOS App程式設計入門,文組生的iOS App程式設計入門講師,彼得潘的 Swift 程式設計入門,App程式設計入門作者,http://apppeterpan.strikingly.com