public static void exportJson(HecDss dssFile, String directory, String regex) throws Exception { int count = 0; HashMap<String, HashMap<String, Integer>> map = new HashMap<String, HashMap<String, Integer>>(); Vector<CondensedReference> v = dssFile.getCondensedCatalog(); ObjectMapper mapper = new ObjectMapper(); cleanDirectory(new File(directory)); new File(directory).mkdir(); for (CondensedReference path : v) { CwsContainer ts = new CwsContainer(); DataContainer dc; String name; String parameter; try { String hecpath = path.getNominalPathname(); if (!regex.contentEquals("") && regex != null) { if (!hecpath.matches(regex)) continue; } dc = dssFile.get(hecpath, true); if (dc instanceof TimeSeriesContainer) { ts.timeSeriesContainer = (TimeSeriesContainer) dc; name = ts.timeSeriesContainer.getLocationName(); parameter = ts.timeSeriesContainer.getParameterName(); if (ts.timeSeriesContainer.times == null) { System.out.println("Ignoring: " + path.getNominalPathname()); continue; } for (int i = 0; i < ts.timeSeriesContainer.times.length; i++) { ts.dates.add(Dss.calcDate(ts.timeSeriesContainer.times[i])); } } else { ts.pairedDataContainer = (PairedDataContainer) dc; parameter = "pairedData"; name = ts.pairedDataContainer.location; } } catch (Exception e2) { continue; } mapper.writeValue(new File(directory + File.separatorChar + count + ".json"), ts); if (!map.containsKey(name)) { map.put(name, new HashMap<String, Integer>()); } map.get(name).put(parameter, count); count += 1; } mapper.writeValue(new File(directory + File.separatorChar + "index.json"), map); }