Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #4 from patandrick/master
Browse files Browse the repository at this point in the history
fixing output issue
  • Loading branch information
mrandi authored Apr 4, 2018
2 parents fc71bdb + a137584 commit ad0baa7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ts/background.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import jq from 'jq-web/jq.wasm.js';

function getJq(jsonInput, filter = '.') {
return jq.raw(jsonInput, filter);
return jq(JSON.parse(jsonInput), filter);
}

// Build the connection to the frontend
Expand All @@ -11,9 +11,9 @@ chrome.runtime.onConnect.addListener(port => {
// Listen to messages from frontend
port.onMessage.addListener(msg => {
// Filter the JSON with JQ
const jqResult = getJq(msg.json, msg.filter);
const jqResult = JSON.stringify(getJq(msg.json, msg.filter));
// Send the result from JQ to the frontend
port.postMessage({ jqResult: jqResult });
});
}
});
});
1 change: 1 addition & 0 deletions src/ts/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export function renderCss() {
}

export function updateOutput(output) {
output = JSON.stringify(JSON.parse(output), null, 2);
const editor = ace.edit('json-editor-output');
editor.setValue(output);
editor.clearSelection();
Expand Down

0 comments on commit ad0baa7

Please sign in to comment.