JSFiddle - React, Tailwind, and code Playground
by yawhuat
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JSON</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</head>
<body>
<div class="container pt-3">
<h1>JSON (Declare and Retriving)</h1>
<p>
JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write, and easy for machines to parse and generate. It is often used to transmit data between a server and web application, as well as between different parts of a program. In the context of ChatGPT, JSON might be used to structure and exchange data. You must writh JSON file in
<br><br>
<code>
let user =[<br>
{<br>
id:'0',<br>
name:'Jeremy',<br>
password:'abc123'<br>
} <br> ] <br>
</code>
<br>
To retrieve the data from JSON file, you can use the following code:. Let's say you want to access the <i>name</i><br>
<code>
console.log(user[0].name);
</code>
<br>
<br>
<i>I would like you to create a JSON Array with 5 objects. Each object should have <b>id, name and password </b>. Just make any kind of data under the script tag</i>
</p>
</div>
</body>
<script>
let user =[
{
id:'0',
name:'Jeremy',
password:'abc123'
},
...