Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ember helper {{json-pretty-print someJson}}
// app/helpers/json-pretty-print.js
// usage {{json-pretty-print someJson}}
// see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument
import Helper from '@ember/component/helper';
export default Helper.extend({
compute(params, hash) {
const [json] = params;
return JSON.stringify(json, null, ' ');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.