def demands_to_j(obj):
    """ A function to partially convert a demand dictionary to JSON format.

        Parameters
        ----------
        obj : dictionary
            a demand dictionary, indexed by a node pair, with value the demand volume.

        Returns
        -------
        list_of_dicts : list
            a list of dictionaries that can readily be converted to JSON with the json
            standard library routines.
    """
    tmp = []
    for d in obj.keys():
        tmp.append({"source": d[0], "target": d[1], "demand": obj[d]})
    return tmp