JsonLoader extends LzoBaseLoadFunc { protected Tuple parseStringToTuple(String line) { try { JSONObject jsonObj = (JSONObject) jsonParser.parse(line); if (jsonObj != null) { return tupleFactory.newTuple(walkJson(jsonObj)); } else { LOG.warn("Could not json-decode string: " + line); incrCounter(JsonLoaderCounters.LinesParseError, 1L); return null; } } catch (ParseException e) { LOG.warn("Could not json-decode string: " + line, e); incrCounter(JsonLoaderCounters.LinesParseError, 1L); return null; } catch (NumberFormatException e) { LOG.warn("Very big number exceeds the scale of long: " + line, e); incrCounter(JsonLoaderCounters.LinesParseErrorBadNumber, 1L); return null; } catch (ClassCastException e) { LOG.warn("Could not convert to Json Object: " + line, e); incrCounter(JsonLoaderCounters.LinesParseError, 1L); return null; } } JsonLoader();  JsonLoader(String optString); void setInputFormatClassName(String inputFormatClassName); @Override Tuple getNext(); @Override InputFormat getInputFormat(); static final String NESTED_LOAD_KEY; }
@Test public void testNullString() { String nullString = "null"; JsonLoader jsonLoader = new JsonLoader(); Tuple result = jsonLoader.parseStringToTuple(nullString); Assert.assertEquals("Parsing line with contents 'null'", null, result); }