updated to support linear and hierarchy formats for json and xml data