import codecs
import json


def read_json_line(json_path, encoding='utf-8', limit = None):
    """ Read Json File, one json object per line
    """
    f_in = codecs.open(json_path, encoding = encoding)
    json_obj_list = []
    cnt = 0
    for line in f_in:
        cnt += 1
        if cnt % 100000 == 10:
            print ("File Reading line %d" % cnt)
        if limit is not None:
            if cnt > limit:
                break
        line = line.strip().replace("\n", "")
        json_obj = json.loads(line)
        json_obj_list.append(json_obj)
    return json_obj_list