Extract JSON to TXT


#1

Hello folks,

Do you know some tricks to extract JSON to plain TXT using meteor?

I know how to get the JSON by doing something like this:

Template.exampleTemplate.events({
  "click [data-action='btn-get']": function () {
    var result = $('#simplequery').queryBuilder('getRules');
    if (!$.isEmptyObject(result)) {
      console.log(JSON.stringify(result, null, 2));
    }
  }
});

My question is if I have JSON data as:

{
"condition": "AND",
"rules": [
{
"id": "demographics",
"field": "demographics",
"type": "string",
"operator": "equal",
"value": "Gender.1"
}
]
}

how to i get the resulting JSON in separate line, for example

"demographics"
"demographics"
"string"
"equal"
"Gender"
"1"

#2

You could use Object.values(objectname) which will give you an array of values. But why?