summaryrefslogtreecommitdiff
path: root/py_common/common_json.py
blob: 61aec60d506d1e01c7b1844146f653a42925fdcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# coding: utf-8

import sys
import psutil
import time
import json

#return value:
# 0, error msg, json_dict : succ
# 1, error msg, "" : error
def tsg_json_parse(file_name):
    try:
        with open(file_name) as json_fp:
            try:
                json_dict = json.load(json_fp)
                return 0, "", json_dict
            except Exception as e:
                return 1, e, ""
    except Exception as e:
        return 1, e , ""