---
layout: post
title:  "day 11"
date:  2018-01-17
categories: programming
---

# 100 Days of Code

### Day 11:
Took a break on the weekend, but I am back at it. Today, I made a class for
decoding json data. Here is the code. I can use this with my xonsh shell now so
its proving to be useful.

```python 

import os
import json
from pprint import pprint

class JsonUtils(object):
    """ Json utility library """


    def decode(self, json_file):
        """ Decode a json string or file that contains json """
        if os.path.isfile(json_file):
            with open(json_file, 'r'):
                data = json.load(json_file)
                return pprint(data)
        else:
            data = json.loads(json_file)
            return pprint(data)
```
