Skip to main content

JSON Basics

Made by: CodingHome.
Published by: AT Products LLC.

Example Document

JSON
{ "foo": "bar", "array": [ "foo", "bar" ] }

All JSON files are surrounded by { and }, which means it is a object. Unlike Javascript, you must use double quotes (") for strings, not singular quotes (')

Importing JSON

Importing JSON is different in different languages. Here are some examples:

JavaScript
fetch('example.json')
Node.js
import('./example.json')
TypeScript
import data from 'example.json'
Python
import 'json'; with open('data.json', 'r') as f: data = json.load(f)