import json


def from_json(text):
    """Parse text as json.
    """
    # If `text` is a byte string, decode it as utf-8.
    if isinstance(text, bytes):
        text = text.decode('utf-8')
    return json.loads(text)