예제 #1
0
 def testComplexjson(self):
   json_string = '{name:Katie, dict:{key1:value1,key2:value2}}'
   
   json_objs_list = parse_json.parse(json_string)
   
   self.assertEqual(json_objs_list[0], json_string,
                     make_err('', json_objs_list[0], json_string))
예제 #2
0
def assemble_obj_attrs(decoded_json):
  obj_dict = decoded_json
  
  if type(decoded_json) is str:
    if value[0] == '{':
      json_string = parse_json.parse(value)
      return decoder.JsonDecoder().decode(json_string)
  
  if is_iter(decoded_json):
    return parse_iter(value)
  
  return decoded_json
예제 #3
0
  def testParseMultipleObjs(self):
    json_obj_0 = '{name:katie}'
    json_obj_1 = '{name:brian}'
    
    json_string = json_obj_0 + json_obj_1
    json_objs_list = parse_json.parse(json_string)

    self.assertNotEqual(
        json_objs_list,
        [],
        'Parsed string did not contain any complete json strings.')
    
    self.assertEqual(json_objs_list[0], 
                    json_obj_0, 
                    make_err('First', json_objs_list[0], json_obj_0))
    self.assertEqual(json_objs_list[1], 
                    json_obj_1,
                    make_err('Last', json_objs_list[1], json_obj_1))