Skip to content

Commit

Permalink
feat(plugin): better json parsing support
Browse files Browse the repository at this point in the history
Relates #5729
  • Loading branch information
alyec committed Apr 1, 2015
1 parent 6d86161 commit 1b93788
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/js/plugins/jsonParse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* global RAMP, console */

console.log('loading jsonParse');
RAMP.plugins.featureInfoParser.jsonParse = function (data) {
'use strict';
var summary, fullData;

data = { a: 1, b: '2', c: true, d: [1, 2, 3], e: { f: 1, g: 2 }, h: null };

summary = ''.join(Object.keys(data).filter(function (e) { return typeof e !== 'object' && typeof e !== 'undefined'; }).map(function (e) { return '<tr><th>{0}</th><td>{1}</td></tr>'.format(e, data[e]); }));

return "<p>{0}</p>".format(data);
};

0 comments on commit 1b93788

Please sign in to comment.