Class JsonInputStream

java.lang.Object
java.io.InputStream
com.illumon.iris.importers.util.JsonInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class JsonInputStream extends InputStream
A stream that transforms JSON into CSV using a recursive flattening of each JSON object (one top level JSON object per CSV row). The input file should contain plain JSON objects, not comma separated or an array. e.g. the following is a legal file with 3 objects, which will result in 3 rows: {a:1} {a:2} {a:3} You may have multiple JSON objects on a single line, and/or the JSON objects may span multiple lines. Nested objects are recursively expanded, with the column name for each field derived from the full "path" to that field. The path separator is specified in the constructor. Array elements are numbered with a zero-based index. For example: { "a":1, "b":{ "c":2, "d":3 }, "e":[4,5,6] } maps to a schema with the columns "a", "b_c", "b_d", "e0", "e1", "e2" and a row with values 1, 2, 3, 4, 5, 6 (the path separator used here is "_")