Skip to main content
added yaml format
Source Link
wisbucky
  • 38.9k
  • 15
  • 170
  • 114

This prints out all the object contents recursively in json or yaml indented format:

import jsonpickle # pip install jsonpickle import json import yaml # pip install pyyaml serialized = jsonpickle.encode(obj, max_depth=2) # max_depth is optional print json.dumps(json.loads(serialized), indent=4) print yaml.dump(yaml.load(serialized), indent=4) 

This prints out all the object contents recursively in json indented format:

import jsonpickle # pip install jsonpickle import json serialized = jsonpickle.encode(obj, max_depth=2) # max_depth is optional print json.dumps(json.loads(serialized), indent=4) 

This prints out all the object contents recursively in json or yaml indented format:

import jsonpickle # pip install jsonpickle import json import yaml # pip install pyyaml serialized = jsonpickle.encode(obj, max_depth=2) # max_depth is optional print json.dumps(json.loads(serialized), indent=4) print yaml.dump(yaml.load(serialized), indent=4) 
Source Link
wisbucky
  • 38.9k
  • 15
  • 170
  • 114

This prints out all the object contents recursively in json indented format:

import jsonpickle # pip install jsonpickle import json serialized = jsonpickle.encode(obj, max_depth=2) # max_depth is optional print json.dumps(json.loads(serialized), indent=4)