@Test
  public void testSerialize() throws SerDeException, IOException {
    Properties props = new Properties();
    props.setProperty(serdeConstants.LIST_COLUMNS, "a,b,c,d,e,f");
    props.setProperty(serdeConstants.LIST_COLUMN_TYPES,
        "int,int,struct<c:int,d:int>,string,array<int>,map<int,float>");
    props.setProperty(serdeConstants.TIMESTAMP_FORMATS, "millis");

    final String jsonText = loadJson("complex_write.json");

    JsonSerDe serde = new JsonSerDe();
    serde.initialize(new Configuration(), props, null, false);

    ObjectInspector oi = serde.getObjectInspector();

    Map<IntWritable, FloatWritable> map = new LinkedHashMap<>();
    map.put(new IntWritable(666), new FloatWritable(0.12345f));
    map.put(new IntWritable(999), new FloatWritable(0.6789f));

    Object testStructure = Arrays.asList(new IntWritable(2), new IntWritable(3),
        Arrays.asList(new IntWritable(2), new IntWritable(3)),
        new Text("SomeData"),
        Arrays.asList(new IntWritable(101), new IntWritable(102)), map);

    Object result = serde.serialize(testStructure, oi);
    Text text = (Text) result;
    Assert.assertEquals(jsonText, text.toString());
  }
When parsing the JSON object, a cache is kept for the definition of each
field and it index in its most immediate struct. Check that if two names
have the same name, in the same index of their respective structs, that
they are not confused with one-another.
serde/src/test/org/apache/hadoop/hive/serde2/TestJsonSerDe.java