#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
class Persister(object):


    @staticmethod
    def json_save(data, location, mode="w"):
    	if not os.path.exists(os.path.dirname(location)):
    		os.makedirs(os.path.dirname(location))
        with open(location, 'w') as json_file:
            json.dump(data, json_file)

    @staticmethod
    def json_load(location, mode="r"):
        with open(location, mode=mode) as json_file:
            data = json.load(json_file)
        return data