Skip to content

Instantly share code, notes, and snippets.

@jpadams
Created January 25, 2018 02:01
Show Gist options
  • Select an option

  • Save jpadams/6ce14b8932bffcd674b50c0053dabd1c to your computer and use it in GitHub Desktop.

Select an option

Save jpadams/6ce14b8932bffcd674b50c0053dabd1c to your computer and use it in GitHub Desktop.
facts = [
{
"name": "processors",
"value": "{\"isa\":\"x64\",\"count\":4,\"models\":[\"Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz\",\"Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz\",\"Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz\",\"Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz\"],\"physicalcount\":4}",
"environment": "production",
"id": "mission-3-processors"
}
]
function prettyStructured (k,v) {
try {if (k == "value" && typeof(JSON.parse(v)) == "object") {
v = JSON.stringify(JSON.parse(v), null, 2).replace(/\n/g, "\n");
} } catch(e) {}
return v;
}
j = JSON.stringify(facts, prettyStructured ,2)
print(j)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment