Exemplo n.º 1
0
 def json_array(self, s_and_end, scan_once, **kwargs):
     """ Convert JSON array to be a list_node object """
     values, end = JSONArray(s_and_end, scan_once, **kwargs)
     s, start = s_and_end
     beg_mark, end_mark = get_beg_end_mark(s, start, end,
                                           self.newline_indexes)
     return ListNode(values, beg_mark, end_mark), end
Exemplo n.º 2
0
 def isJsonValid(self):
     response = self.i_send_get_request_api_endpoint()
     json_file = json.loads(response.text)
     print(json_file)
     try:
         JSONObject(json_file)
         # return True
     except Exception:
         try:
             JSONArray(json_file)
         except Exception:
             return False
     return True
Exemplo n.º 3
0
def JSONTuple(*args, **kw):
    """Parse a JSON array, and return it in tuple form, along with the
    character position where we stopped parsing. Simple wrapper around
    the stock JSONArray parser."""
    values, end = JSONArray(*args, **kw)
    return tuple(values), end