From 352ae4ea02fd0e30e20b49b320bc601f45fd7560 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Wed, 13 Dec 2017 12:52:15 +0530 Subject: Add json print format Issue-ID: CLI-66 Change-Id: Ic032912de0b302352f5c8ed94749ddd012f55af6 Signed-off-by: Kanagaraj Manickam k00365106 --- .../onap/cli/fw/output/print/OnapCommandPrint.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'framework') diff --git a/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java b/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java index 3946c5da..389aee36 100644 --- a/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java +++ b/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java @@ -31,6 +31,9 @@ import org.apache.commons.csv.CSVPrinter; import org.onap.cli.fw.error.OnapCommandOutputPrintingFailed; import org.onap.cli.fw.output.OnapCommandPrintDirection; +import net.minidev.json.JSONArray; +import net.minidev.json.JSONObject; + /** * Oclip Command Table print. * @@ -241,8 +244,20 @@ public class OnapCommandPrint { } public String printJson() { - // (mrkanag) print in json - return null; + List> rows = this.formRows(false); + + JSONArray array = new JSONArray(); + + //skip first row title + for (int i=1; i