Skip to content

Commit

Permalink
json process runner
Browse files Browse the repository at this point in the history
  • Loading branch information
fireduck64 committed Aug 2, 2018
1 parent a51dc75 commit 46f3af5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/jsonrpc/JsonProcessRunner.java
@@ -0,0 +1,24 @@
package duckutil.jsonrpc;

import net.minidev.json.parser.JSONParser;
import net.minidev.json.JSONObject;
import duckutil.ProcessRunner;
import java.util.Collection;

public class JsonProcessRunner extends ProcessRunner
{
public JsonProcessRunner(Collection<String> cmd)
throws Exception
{
super(cmd);
}

public JSONObject getJsonOutput()
throws Exception
{
JSONParser parser = new JSONParser(JSONParser.MODE_STRICTEST);
JSONObject json = (JSONObject)parser.parse(getOutput());
return json;
}
}

0 comments on commit 46f3af5

Please sign in to comment.