Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Python Fundamentals

Lesson 23 of 55 · Python

Working with JSON

Duration: 20 minutes

Working with JSON\n\nJSON (JavaScript Object Notation) is a lightweight data‑exchange format. Python’s json module makes converting between JSON strings and native objects effortless.\n\npython\nimport json\n\n# Serialize a Python dict to JSON\ndata = {'name': 'Alice', 'age': 30}\njson_str = json.dumps(data)\nprint('JSON:', json_str)\n\n# Deserialize back to a dict\nloaded = json.loads(json_str)\nprint('Name from JSON:', loaded['name'])\n\n\nWhen working with files, use json.dump() and json.load() to read/write directly.\n

Previous: Importing Standard LibraryNext: Regular Expressions