Skip to main content
Example Documents Importing JSON

JSON Basics

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

Example Document


{
  "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

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