Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of work with JSON in Python
# -*- coding: utf-8 -*-
# Example of work with JSON in Python
# Requires jsonpickle. To git it in Debian/Ubuntu:
# sudo apt-get install python-jsonpickle
import jsonpickle
__author__ = 'Dmitriy Sukharev'
class Book:
def __init__(self, isbn, title, authors):
self.isbn = isbn
self.title = title
self.authors = authors
book = Book('8789676775433', "Effective Python", ['Smith', 'Jackson'])
jsonstr = None
jsonstr = jsonpickle.encode(book, False)
boook = jsonpickle.decode(jsonstr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.