{"info":{"_postman_id":"858a2dc5-bc72-49a0-90c2-fff466eadc8f","name":"Visualizer Template: Tree","description":"<html><head></head><body><p>A collection of API requests to demonstrate the data visualization feature through a cross filter, created by student developers at Berkeley CodeBase.</p>\n<p>For the full list of visualizer templates we have created, click <a href=\"https://explore.postman.com/templates/4424\">here</a>.</p>\n<br>\n\n<p>This tree allows us to visualize the JSON tree structure of any API response, including nested elements. Nodes of nested elements are fully collapsible and can be helpful for analyzing complex, heavily nested datasets.</p>\n<br>\n\n<p><img src=\"https://raw.githubusercontent.com/isabelleyzhou/postman_visualizer_templates/master/tree/NYT.png\" alt=\"alt text\"></p>\n<br>\n\n<p>This collection contains three sample usages for the tree visualizer which visualizes the structure of an API response.</p>\n<ol>\n<li>New York Times: Most Viewed Articles</li>\n<li>Spotify: Top Tracks</li>\n<li>Twitter: Top Tweets by Wendy's</li>\n</ol>\n<p>For detailed explanation on a request, check its description.\n<br>\n<br>\n<strong>Visualization Data Parsing</strong></p>\n<p>At the bottom of the test script, in the <code>parseData()</code> function, the data is formatted into the <code>dataTree</code> (structure shown below) by feeding in the data into the function <code>restructure(input, arr)</code>. \n<br>\n<br></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>var treeData = [\n    \"name\": \"root\"\n    \"children\": [\n        {\n            \"name\": \"child1\",\n            \"children\": [\n                {\n                    \"name\": \"grandchild1\"\n                },\n                {\n                    \"name\": \"grandchild2\"\n                }\n            ]\n        },\n        {\n            \"name\": \"child2\"\n        }\n    ]\n]\n</code></pre><br>\n<br>\n\n<p>The only line of code that the developer needs to modify exists at the bottom of the test script. The input is one object in the API response. We are assuming that the API response is a list of repeated objects.\n<br>\n<br></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>results: JSON.stringify(parseData(input))\n</code></pre></body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"6823810","collectionId":"858a2dc5-bc72-49a0-90c2-fff466eadc8f","publishedId":"SW7gSjR1","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2019-11-28T07:57:33.000Z"},"item":[{"name":"Spotify Top Tracks","event":[{"listen":"test","script":{"id":"9b46cc80-0c65-439d-8a25-0e1b19f64642","exec":["var template = `","<script src=\"https://d3js.org/d3.v5.min.js\"></script>","<style>","body {","    display: flex;","    align-items: center;","    justify-content: center;","    background-color: #F5F5F5;","   ","}","",".container {","    position: absolute;","    z-index: -999;","    height: 100vh;","    width: 100vw;","}","",".tooltip {","    z-index: 99;","    position: absolute;","    font-size: 12px;","    width: auto;","    height: auto;","    pointer-events: none;","    background-color: white;","    padding: 3px;","    opacity: 1;","}","",".point {","    fill: #F5F5F5;","    stroke: #F09D51;","    stroke-width: 2px;","}","","</style>","<div id=\"tree\"></div>","<div class=\"container\">","<script>","const treeData = {{{results}}};","var maxChildren = 0;","var treeLevelSpan = {0:1};","","//finds the max number of nodes in a column","function getMaxChildrenSpan(input, level) {","    var childrenLength = 0;","    if (input.hasOwnProperty(\"children\") && input[\"children\"] != null && typeof input[\"children\"] != undefined ) {","        childrenLength =  input.children.length;","    }","    let totalNumChildren = 0;","    if (input.hasOwnProperty(\"children\") && input[\"children\"] != null && typeof input[\"children\"] != undefined) {","        for (let child of input.children) {","            if (child.hasOwnProperty(\"children\") && child[\"children\"] != null && typeof child[\"children\"] != undefined) {","                getMaxChildrenSpan(child, level + 1)","            }","        }","    }","    if (level in treeLevelSpan) {","        treeLevelSpan[level] += childrenLength;","    }","    else {","        treeLevelSpan[level] = childrenLength;","    }","}","getMaxChildrenSpan(treeData, 1);","let arrayOfLevelSpan = Object.values(treeLevelSpan)","let maxSpan = Math.max(...arrayOfLevelSpan);","","","// Set the dimensions and margins of the diagram","var margin = {top: 20, right: 90, bottom: 30, left:90},","    width = 960 - margin.left - margin.right,","    height = 500 + (maxSpan*30) - margin.top - margin.bottom;","","","","// append the svg object to the body of the page","// appends a 'group' element to 'svg'","// moves the 'group' element to the top left margin","var svg = d3.select(\"body\").append(\"svg\")","    .attr(\"width\", width + margin.right + margin.left)","    .attr(\"height\", height + margin.top + margin.bottom)","    .append(\"g\")","        .attr(\"transform\", \"translate(\"","            + margin.left  + \",\" + margin.top + \")\");","","","var i = 0,","    duration = 750,","    root;","","// declares a tree layout and assigns the size","var treemap = d3.tree().size([height, width]);","","// Assigns parent, children, height, depth","root = d3.hierarchy(treeData, function(d) { return d.children; });","root.x0 = height / 2;","root.y0 = 0;","","// Collapse after the second level","// root.children.forEach(collapse);","","update(root);","","// Collapse the node and all it's children","function collapse(d) {","  if(d.children) {","    d._children = d.children","    d._children.forEach(collapse)","    d.children = null","  }","}","","function update(source) {","  // Assigns the x and y position for the nodes","  var treeData = treemap(root);","  ","  //svg height dynamically changed by max number of open nodes in a column","  treeLevelSpan = {};","  getMaxChildrenSpan(root, 1);","  arrayOfLevelSpan = Object.values(treeLevelSpan)","  maxSpan = Math.max(...arrayOfLevelSpan);","  height = 500 + (maxSpan*30) - margin.top - margin.bottom;","  treeData = d3.tree().size([height, width])(root);","","","  // Compute the new tree layout.","  var nodes = treeData.descendants(),","      links = treeData.descendants().slice(1);","","  // Normalize for fixed-depth.","  nodes.forEach(function(d) { d.y = d.depth * width * 0.25 });","","  // ****************** Nodes section ***************************","","  // Update the nodes...","  var node = svg.selectAll('g.node')","      .data(nodes, function(d) {return d.id || (d.id = ++i); });","","  // Enter any new nodes at the parent's previous position.","  var nodeEnter = node.enter().append('g')","      .attr('class', 'node')","      .attr(\"transform\", function(d) {","        return \"translate(\" + source.y0 + \",\" + source.x0 + \")\";","    })","    .on('click', click);","    ","    // Create hover tooltip","    let tooltip = d3.select(\"#tree\").append(\"div\")","        .attr(\"class\", \"tooltip\")","        ","    // tooltip mouseover event handler","    let tipMouseover = function(d) {","        tooltip.html(\"Data Type: <br/>\" + d.data.type)","            .style(\"left\", (d3.event.pageX + 40) + \"px\")","            .style(\"top\", (d3.event.pageY - 15) + \"px\")","          .transition()","            .duration(200)      // ms","            ","    };","    // tooltip mouseout event handler","    let tipMouseout = function(d){","        tooltip.transition()","            .duration(300)","            .style(\"opacity\", 0);","    };","    ","    ","  // Add Circle for the nodes","  nodeEnter.append('circle')","      .attr('class', 'point')","      .attr('r', 1e-6)","      .on(\"mouseover\", tipMouseover)","      .on(\"mouseout\", tipMouseout)","      .style(\"fill\", function(d) {","          return d._children ? \"#F4B780\" : \"#fff\";","      })","      ","      ","  // Add labels for the nodes","  nodeEnter.append('text')","      .attr(\"dy\", \".35em\")","      .attr(\"x\", function(d) {","          return d.children || d._children ? -20 : 20;","      })","      .attr(\"text-anchor\", function(d) {","          return d.children || d._children ? \"end\" : \"start\";","      })","      .text(function(d) { return d.data.name; });","      ","","  // UPDATE","  var nodeUpdate = nodeEnter.merge(node);","","  // Transition to the proper position for the node","  nodeUpdate.transition()","    .duration(duration)","    .attr(\"transform\", function(d) { ","        return \"translate(\" + d.y + \",\" + d.x +\")\";//this","     });","","  // Update the node attributes and style","  nodeUpdate.select('circle.point')","    .attr('r', 10)","    .style(\"fill\", function(d) {","        return d._children ? \"#F4B780\" : \"#F5F5F5\";","    })","    .attr('cursor', 'pointer');","","","  // Remove any exiting nodes","  var nodeExit = node.exit().transition()","      .duration(duration)","      .attr(\"transform\", function(d) {","          return \"translate(\" + source.y + \",\" + source.x + \")\"; ","      })","      .remove();","","  // On exit reduce the node circles size to 0","  nodeExit.select('circle')","    .attr('r', 0);","","  // On exit reduce the opacity of text labels","  nodeExit.select('text')","    .style('fill-opacity', 0);","","  // ****************** links section ***************************","","  // Update the links...","  var link = svg.selectAll('path.link') ","      .data(links, function(d) { return d.id; });","","  // Enter any new links at the parent's previous position.","  var linkEnter = link.enter().insert('path', \"g\")","      .attr(\"class\", \"link\")","      .attr('d', function(d){","        var o = {x: source.x0, y: source.y0}","        return diagonal(o, o)","      })","      .style(\"fill\", \"none\")","      .style(\"stroke\",\"#c5c5c5\")","      .style(\"stroke-width\", \"1px\");","","  // UPDATE","  var linkUpdate = linkEnter.merge(link);","","  // Transition back to the parent element position","  linkUpdate.transition()","      .duration(duration)","      .attr('d', function(d){ return diagonal(d, d.parent) });","","  // Remove any exiting links","  var linkExit = link.exit().transition()","      .duration(duration)","      .attr('d', function(d) {","        var o = {x: source.x, y: source.y}","        return diagonal(o, o)","      })","      .remove();","","  // Store the old positions for transition.","  ","  nodes.forEach(function(d){","    d.x0 = d.x;","    d.y0 = d.y;","  });","","  // Creates a curved (diagonal) path from parent to the child nodes","  function diagonal(s, d) {","    path = \"M \" + s.y +\" \" + s.x + \" \" +","           \"C \" + (s.y + d.y)/2 + \" \" + s.x +\", \"","        +  (s.y + d.y)/2 +\" \" + d.x + \" , \"","        +  d.y + \" \" + d.x;","    return path;","  }","","  // Toggle children on click.","  function click(d) {","    if (d.children) {","        d._children = d.children;","        d.children = null;","      } else {","        d.children = d._children;","        d._children = null;","      }","    update(d);","  }"," ","}","","</script>","`;","","","/* DATA PARSING */","const response = pm.response.json();","","function parseData(jsonInput) {","    // Function that checks if object is a dictionary","    function isDictionary(obj) {","        if (typeof obj == \"object\" && !Array.isArray(obj) && obj !== null) {","            return true;","        } else {","            return false;","        }","    }","    ","    // Declare and initialize the root node","    const dataTree = {};","    ","    dataTree[\"name\"] = \"response\";","    dataTree[\"children\"] = [];","    dataTree[\"type\"] = typeof(dataTree);","    ","    // Recursively reformats the json file ","    // See documentation for format","    function restructure(input, arr) {","        for (let node in input) {","            const dict = {};","            if (isDictionary(input[node])) {","                dict.name = node;","                dict.type = \"dictionary\"","                dict.children = [];","                restructure(input[node], dict.children);","            } else {","                if (Array.isArray(input[node])) {","                    dict.type = \"array\";              ","                }","                else if (input[node] === null) {","                    dict.type = \"null\";","                }","                else {","                    dict.type = typeof(input[node]);","                }","                dict.name = node;","            }","            arr.push(dict);","        }","    }","    ","    // Calls restructure on the first object in the response","    restructure(jsonInput, dataTree.children);","    ","    return dataTree","    ","}","","/* FEED DATA INTO TEMPLATE */","pm.visualizer.set(template, {","  // Template will receive stringified JSON","  ","  /* EDIT THIS LINE: Here we grab the first object from the reponse dictionary as all","    objects in the dictionary have the same structure */","  results: JSON.stringify(parseData(response.tracks[0]))","});",""],"type":"text/javascript"}}],"id":"97287649-cf31-4113-9a85-93f159240902","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"oauth2","oauth2":{"basicConfig":[{"key":"accessToken","value":"<access-token>"}],"advancedConfig":[{"key":"tokenType","value":"<token-type>"}]},"isInherited":false},"method":"GET","header":[{"key":"Content-Type","name":"Content-Type","value":"application/x-www-form-urlencoded","type":"text"}],"body":{"mode":"urlencoded","urlencoded":[]},"url":"https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE/top-tracks?country=SE","description":"<p>Visualizes the structure of the response from the Spotify API: top tracks.\n<br />\n<br />\n<em>Sample JSON response</em></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>{\n  \"tracks\": [\n    {\n      \"album\": {\n        \"album_type\": \"album\",\n        \"artists\": [\n          {\n            \"external_urls\": {\n              \"spotify\": \"https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE\"\n            },\n            \"href\": \"https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE\",\n            \"id\": \"43ZHCT0cAZBISjO8DG9PnE\",\n            \"name\": \"Elvis Presley\",\n            \"type\": \"artist\",\n            \"uri\": \"spotify:artist:43ZHCT0cAZBISjO8DG9PnE\"\n          }\n        ],\n        \"external_urls\": {\n          \"spotify\": \"https://open.spotify.com/album/7xe8VI48TxUpU1IIo0RfGi\"\n        },\n        \"href\": \"https://api.spotify.com/v1/albums/7xe8VI48TxUpU1IIo0RfGi\",\n        \"id\": \"7xe8VI48TxUpU1IIo0RfGi\",\n        \"images\": [\n          {\n            \"height\": 640,\n            \"url\": \"https://i.scdn.co/image/ab67616d0000b273f96cefb0197694ad440c3314\",\n            \"width\": 640\n          },\n          {\n            \"height\": 300,\n            \"url\": \"https://i.scdn.co/image/ab67616d00001e02f96cefb0197694ad440c3314\",\n            \"width\": 300\n          },\n          {\n            \"height\": 64,\n            \"url\": \"https://i.scdn.co/image/ab67616d00004851f96cefb0197694ad440c3314\",\n            \"width\": 64\n          }\n        ],\n        \"name\": \"Blue Hawaii\",\n        \"release_date\": \"1961-10-20\",\n        \"release_date_precision\": \"day\",\n        \"total_tracks\": 14,\n        \"type\": \"album\",\n        \"uri\": \"spotify:album:7xe8VI48TxUpU1IIo0RfGi\"\n      },\n      \"artists\": [\n        {\n          \"external_urls\": {\n            \"spotify\": \"https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE\"\n          },\n          \"href\": \"https://api.spotify.com/v1/artists/43ZHCT0cAZBISjO8DG9PnE\",\n          \"id\": \"43ZHCT0cAZBISjO8DG9PnE\",\n          \"name\": \"Elvis Presley\",\n          \"type\": \"artist\",\n          \"uri\": \"spotify:artist:43ZHCT0cAZBISjO8DG9PnE\"\n        }\n      ],\n      \"disc_number\": 1,\n      \"duration_ms\": 182360,\n      \"explicit\": false,\n      \"external_ids\": {\n        \"isrc\": \"USRC16101350\"\n      },\n      \"external_urls\": {\n        \"spotify\": \"https://open.spotify.com/track/44AyOl4qVkzS48vBsbNXaC\"\n      },\n      \"href\": \"https://api.spotify.com/v1/tracks/44AyOl4qVkzS48vBsbNXaC\",\n      \"id\": \"44AyOl4qVkzS48vBsbNXaC\",\n      \"is_local\": false,\n      \"is_playable\": true,\n      \"name\": \"Can't Help Falling in Love\",\n      \"popularity\": 79,\n      \"preview_url\": \"https://p.scdn.co/mp3-preview/994ebd7f49e4e935df56d450b0c12d8bad8bb9f4?cid=ab343db462f8494ea1e3f226eb7bc0cc\",\n      \"track_number\": 5,\n      \"type\": \"track\",\n      \"uri\": \"spotify:track:44AyOl4qVkzS48vBsbNXaC\"\n    },\n            \n    . . .\n  ]\n\n}\n</code></pre><br />\n<br />\n\n<p><em>Sample Tree</em></p>\n<p><img src=\"https://raw.githubusercontent.com/isabelleyzhou/postman_visualizer_templates/master/tree/Spotify.png\" alt=\"alt text\" /></p>\n","urlObject":{"protocol":"https","path":["v1","artists","43ZHCT0cAZBISjO8DG9PnE","top-tracks"],"host":["api","spotify","com"],"query":[{"key":"country","value":"SE"}],"variable":[]}},"response":[],"_postman_id":"97287649-cf31-4113-9a85-93f159240902"},{"name":"Twitter","event":[{"listen":"test","script":{"id":"727f393b-6a18-4ad3-8989-2635e7af0de0","exec":["var template = `","<script src=\"https://d3js.org/d3.v5.min.js\"></script>","<style>","body {","    display: flex;","    align-items: center;","    justify-content: center;","    background-color: #F5F5F5;","   ","}","","",".container {","    position: absolute;","    z-index: -999;","    height: 100vh;","    width: 100vw;","}","","</style>","<div id=\"tree\"></div>","<div class=\"container\">","<script>","const treeData = {{{results}}};","var maxChildren = 0;","var treeLevelSpan = {0:1};","","//finds the max number of nodes in a column","function getMaxChildrenSpan(input, level) {","    var childrenLength = 0;","    if (input.hasOwnProperty(\"children\") && input[\"children\"] != null && typeof input[\"children\"] != undefined ) {","        childrenLength =  input.children.length;","    }","    let totalNumChildren = 0;","    if (input.hasOwnProperty(\"children\") && input[\"children\"] != null && typeof input[\"children\"] != undefined) {","        for (let child of input.children) {","            if (child.hasOwnProperty(\"children\") && child[\"children\"] != null && typeof child[\"children\"] != undefined) {","                getMaxChildrenSpan(child, level + 1)","            }","        }","    }","    if (level in treeLevelSpan) {","        treeLevelSpan[level] += childrenLength;","    }","    else {","        treeLevelSpan[level] = childrenLength;","    }","}","getMaxChildrenSpan(treeData, 1);","let arrayOfLevelSpan = Object.values(treeLevelSpan)","let maxSpan = Math.max(...arrayOfLevelSpan);","","","// Set the dimensions and margins of the diagram","var margin = {top: 20, right: 90, bottom: 30, left:90},","    width = 960 - margin.left - margin.right,","    height = 500 + (maxSpan*30) - margin.top - margin.bottom;","","","","// append the svg object to the body of the page","// appends a 'group' element to 'svg'","// moves the 'group' element to the top left margin","var svg = d3.select(\"body\").append(\"svg\")","    .attr(\"width\", width + margin.right + margin.left)","    .attr(\"height\", height + margin.top + margin.bottom)","    .append(\"g\")","        .attr(\"transform\", \"translate(\"","            + margin.left  + \",\" + margin.top + \")\");","","","var i = 0,","    duration = 750,","    root;","","// declares a tree layout and assigns the size","var treemap = d3.tree().size([height, width]);","","// Assigns parent, children, height, depth","root = d3.hierarchy(treeData, function(d) { return d.children; });","root.x0 = height / 2;","root.y0 = 0;","","// Collapse after the second level","// root.children.forEach(collapse);","","update(root);","","// Collapse the node and all it's children","function collapse(d) {","  if(d.children) {","    d._children = d.children","    d._children.forEach(collapse)","    d.children = null","  }","}","","function update(source) {","  // Assigns the x and y position for the nodes","  var treeData = treemap(root);","  ","  //svg height dynamically changed by max number of open nodes in a column","  treeLevelSpan = {};","  getMaxChildrenSpan(root, 1);","  arrayOfLevelSpan = Object.values(treeLevelSpan)","  maxSpan = Math.max(...arrayOfLevelSpan);","  height = 500 + (maxSpan*30) - margin.top - margin.bottom;","  treeData = d3.tree().size([height, width])(root);","","","  // Compute the new tree layout.","  var nodes = treeData.descendants(),","      links = treeData.descendants().slice(1);","","  // Normalize for fixed-depth.","  nodes.forEach(function(d) { d.y = d.depth * width * 0.25 });","","  // ****************** Nodes section ***************************","","  // Update the nodes...","  var node = svg.selectAll('g.node')","      .data(nodes, function(d) {return d.id || (d.id = ++i); });","","  // Enter any new nodes at the parent's previous position.","  var nodeEnter = node.enter().append('g')","      .attr('class', 'node')","      .attr(\"transform\", function(d) {","        return \"translate(\" + source.y0 + \",\" + source.x0 + \")\";","    })","    .on('click', click);","    ","    // Create hover tooltip","    let tooltip = d3.select(\"#tree\").append(\"div\")","        .attr(\"class\", \"tooltip\")","            .style(\"z-index\", 99)","            .style(\"position\", \"absolute\")","            .style(\"font-size\", \"12px\")","            .style(\"width\", \"auto\")","            .style(\"height\", \"auto\")","            .style(\"pointer-events\", \"none\")","            .style(\"background-color\", \"white\")","            .style(\"padding\", \"3px\")","            .style(\"opacity\", 1);","        ","    // tooltip mouseover event handler","    let tipMouseover = function(d) {","        console.log(d);","        tooltip.html(\"Data Type: <br/>\" + d.data.type)","            .style(\"left\", (d3.event.pageX + 40) + \"px\")","            .style(\"top\", (d3.event.pageY - 15) + \"px\")","          .transition()","            .duration(200)      // ms","            .style(\"opacity\", 1)","    };","    // tooltip mouseout event handler","    let tipMouseout = function(d){","        tooltip.transition()","            .duration(300)","            .style(\"opacity\", 0);","    };","    ","  // Add Circle for the nodes","  nodeEnter.append('circle')","      .attr('class', 'node')","      .attr('r', 1e-6)","      .on(\"mouseover\", tipMouseover)","      .on(\"mouseout\", tipMouseout)","      .style(\"fill\", function(d) {","          return d._children ? \"#F4B780\" : \"#fff\";","      })","      ","      .style(\"fill\", \"#F5F5F5\")","      .style(\"stroke\", \"#F09D51\")","      .style(\"stroke-width\", \"2px\");","      ","      ","","  // Add labels for the nodes","  nodeEnter.append('text')","      .attr(\"dy\", \".35em\")","      .attr(\"x\", function(d) {","          return d.children || d._children ? -20 : 20;","      })","      .attr(\"text-anchor\", function(d) {","          return d.children || d._children ? \"end\" : \"start\";","      })","      .text(function(d) { return d.data.name; });","      ","      ","","  // UPDATE","  var nodeUpdate = nodeEnter.merge(node);","","  // Transition to the proper position for the node","  nodeUpdate.transition()","    .duration(duration)","    .attr(\"transform\", function(d) { ","        return \"translate(\" + d.y + \",\" + d.x +\")\";//this","     });","","  // Update the node attributes and style","  nodeUpdate.select('circle.node')","    .attr('r', 10)","    .style(\"fill\", function(d) {","        return d._children ? \"#F4B780\" : \"#F5F5F5\";","    })","    .attr('cursor', 'pointer');","","","  // Remove any exiting nodes","  var nodeExit = node.exit().transition()","      .duration(duration)","      .attr(\"transform\", function(d) {","          return \"translate(\" + source.y + \",\" + source.x + \")\"; ","      })","      .remove();","","  // On exit reduce the node circles size to 0","  nodeExit.select('circle')","    .attr('r', 0);","","  // On exit reduce the opacity of text labels","  nodeExit.select('text')","    .style('fill-opacity', 0);","","  // ****************** links section ***************************","","  // Update the links...","  var link = svg.selectAll('path.link') ","      .data(links, function(d) { return d.id; });","","  // Enter any new links at the parent's previous position.","  var linkEnter = link.enter().insert('path', \"g\")","      .attr(\"class\", \"link\")","      .attr('d', function(d){","        var o = {x: source.x0, y: source.y0}","        return diagonal(o, o)","      })","      .style(\"fill\", \"none\")","      .style(\"stroke\",\"#c5c5c5\")","      .style(\"stroke-width\", \"1px\");","","  // UPDATE","  var linkUpdate = linkEnter.merge(link);","","  // Transition back to the parent element position","  linkUpdate.transition()","      .duration(duration)","      .attr('d', function(d){ return diagonal(d, d.parent) });","","  // Remove any exiting links","  var linkExit = link.exit().transition()","      .duration(duration)","      .attr('d', function(d) {","        var o = {x: source.x, y: source.y}","        return diagonal(o, o)","      })","      .remove();","","  // Store the old positions for transition.","  ","  nodes.forEach(function(d){","    d.x0 = d.x;","    d.y0 = d.y;","  });","\\","  // Creates a curved (diagonal) path from parent to the child nodes","  function diagonal(s, d) {","    path = \"M \" + s.y +\" \" + s.x + \" \" +","           \"C \" + (s.y + d.y)/2 + \" \" + s.x +\", \"","        +  (s.y + d.y)/2 +\" \" + d.x + \" , \"","        +  d.y + \" \" + d.x;","    return path;","  }","","  // Toggle children on click.","  function click(d) {","    if (d.children) {","        d._children = d.children;","        d.children = null;","      } else {","        d.children = d._children;","        d._children = null;","      }","    update(d);","  }"," ","}","","</script>","`;","","/* DATA PARSING */","const response = pm.response.json();","","function parseData(jsonInput) {","    // Function that checks if object is a dictionary","    function isDictionary(obj) {","        if (typeof obj == \"object\" && !Array.isArray(obj) && obj !== null) {","            return true;","        } else {","            return false;","        }","    }","    ","    // Declare and initialize the root node","    const dataTree = {};","    ","    dataTree[\"name\"] = \"response\";","    dataTree[\"children\"] = [];","    dataTree[\"type\"] = typeof(dataTree);","    ","    // Recursively reformats the json file ","    // See documentation for format","    function restructure(input, arr) {","        for (let node in input) {","            const dict = {};","            if (isDictionary(input[node])) {","                dict.name = node;","                dict.type = \"dictionary\"","                dict.children = [];","                restructure(input[node], dict.children);","            } else {","                if (Array.isArray(input[node])) {","                    dict.type = \"array\";              ","                }","                else if (input[node] === null) {","                    dict.type = \"null\";","                }","                else {","                    dict.type = typeof(input[node]);","                }","                dict.name = node;","            }","            arr.push(dict);","        }","    }","    ","    // Calls restructure on the first object in the response","    restructure(jsonInput, dataTree.children);","    ","    return dataTree","    ","}","","/* FEED DATA INTO TEMPLATE */","pm.visualizer.set(template, {","  // Template will receive stringified JSON","  ","  /* EDIT THIS LINE: Here we grab the first object from the reponse dictionary as all","    objects in the dictionary have the same structure */","  results: JSON.stringify(parseData(response.statuses[0]))","});"],"type":"text/javascript"}}],"id":"ae6e7a5c-8459-4fd7-8799-804776aa05a3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"Bearer AAAAAAAAAAAAAAAAAAAAAGC%2BAAEAAAAAQBDuL%2BuzLMt2L1V6vVejiYu%2By%2Fg%3DbhzUhGy3XIGSTOgi6ptQSBowr4dRRx4dmigMBNgiN3rS5RZ51l","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"url":"https://api.twitter.com/1.1/search/tweets.json?q=@Wendys&result_type=popular&count=50","description":"<p>Visualizes the structure of the response from Twitter API: top tweets by Wendy's.\n<br />\n<br />\n<em>Sample JSON response</em></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>{\n    \"statuses\": [\n        {\n            \"created_at\": \"Tue Nov 19 02:45:41 +0000 2019\",\n            \"id\": 1196620530998292481,\n            \"id_str\": \"1196620530998292481\",\n            \"text\": \"Career-high 26 points for @H23Ash\\n\\n@Wendys Player of the Game https://t.co/1KNWg7tfXT\",\n            \"truncated\": false,\n            \"entities\": {\n                \"hashtags\": [],\n                \"symbols\": [],\n                \"user_mentions\": [\n                    {\n                        \"screen_name\": \"H23Ash\",\n                        \"name\": \"ashton hagans\",\n                        \"id\": 2682044908,\n                        \"id_str\": \"2682044908\",\n                        \"indices\": [\n                            26,\n                            33\n                        ]\n                    },\n                    {\n                        \"screen_name\": \"Wendys\",\n                        \"name\": \"Wendy's\",\n                        \"id\": 59553554,\n                        \"id_str\": \"59553554\",\n                        \"indices\": [\n                            35,\n                            42\n                        ]\n                    }\n                ],\n                \"urls\": [],\n                \"media\": [\n                    {\n                        \"id\": 1196620092886388737,\n                        \"id_str\": \"1196620092886388737\",\n                        \"indices\": [\n                            62,\n                            85\n                        ],\n                        \"media_url\": \"http://pbs.twimg.com/media/EJs_xl3WsAEimkZ.jpg\",\n                        \"media_url_https\": \"https://pbs.twimg.com/media/EJs_xl3WsAEimkZ.jpg\",\n                        \"url\": \"https://t.co/1KNWg7tfXT\",\n                        \"display_url\": \"pic.twitter.com/1KNWg7tfXT\",\n                        \"expanded_url\": \"https://twitter.com/KentuckyMBB/status/1196620530998292481/video/1\",\n                        \"type\": \"photo\",\n                        \"sizes\": {\n                            \"thumb\": {\n                                \"w\": 150,\n                                \"h\": 150,\n                                \"resize\": \"crop\"\n                            },\n                            \"small\": {\n                                \"w\": 680,\n                                \"h\": 381,\n                                \"resize\": \"fit\"\n                            },\n                            \"large\": {\n                                \"w\": 2048,\n                                \"h\": 1149,\n                                \"resize\": \"fit\"\n                            },\n                            \"medium\": {\n                                \"w\": 1200,\n                                \"h\": 673,\n                                \"resize\": \"fit\"\n                            }\n                        }\n                    }\n                ]\n            },\n            \"extended_entities\": {\n                \"media\": [\n                    {\n                        \"id\": 1196620092886388737,\n                        \"id_str\": \"1196620092886388737\",\n                        \"indices\": [\n                            62,\n                            85\n                        ],\n                        \"media_url\": \"http://pbs.twimg.com/media/EJs_xl3WsAEimkZ.jpg\",\n                        \"media_url_https\": \"https://pbs.twimg.com/media/EJs_xl3WsAEimkZ.jpg\",\n                        \"url\": \"https://t.co/1KNWg7tfXT\",\n                        \"display_url\": \"pic.twitter.com/1KNWg7tfXT\",\n                        \"expanded_url\": \"https://twitter.com/KentuckyMBB/status/1196620530998292481/video/1\",\n                        \"type\": \"video\",\n                        \"sizes\": {\n                            \"thumb\": {\n                                \"w\": 150,\n                                \"h\": 150,\n                                \"resize\": \"crop\"\n                            },\n                            \"small\": {\n                                \"w\": 680,\n                                \"h\": 381,\n                                \"resize\": \"fit\"\n                            },\n                            \"large\": {\n                                \"w\": 2048,\n                                \"h\": 1149,\n                                \"resize\": \"fit\"\n                            },\n                            \"medium\": {\n                                \"w\": 1200,\n                                \"h\": 673,\n                                \"resize\": \"fit\"\n                            }\n                        },\n                        \"video_info\": {\n                            \"aspect_ratio\": [\n                                16,\n                                9\n                            ],\n                            \"duration_millis\": 10000,\n                            \"variants\": [\n                                {\n                                    \"content_type\": \"application/x-mpegURL\",\n                                    \"url\": \"https://video.twimg.com/amplify_video/1196620092886388737/pl/eU57Vz_XjLHPN7BN.m3u8?tag=13\"\n                                },\n                                {\n                                    \"bitrate\": 288000,\n                                    \"content_type\": \"video/mp4\",\n                                    \"url\": \"https://video.twimg.com/amplify_video/1196620092886388737/vid/480x270/yFA0o-64ynB05Hz6.mp4?tag=13\"\n                                },\n                                {\n                                    \"bitrate\": 2176000,\n                                    \"content_type\": \"video/mp4\",\n                                    \"url\": \"https://video.twimg.com/amplify_video/1196620092886388737/vid/1024x576/6n2YPpRVMIxoJa0P.mp4?tag=13\"\n                                },\n                                {\n                                    \"bitrate\": 832000,\n                                    \"content_type\": \"video/mp4\",\n                                    \"url\": \"https://video.twimg.com/amplify_video/1196620092886388737/vid/640x360/igUHJBlF8aRncGC4.mp4?tag=13\"\n                                }\n                            ]\n                        },\n                        \"additional_media_info\": {\n                            \"title\": \"Ashton Hagans\",\n                            \"description\": \"Wendy's Player of the Game\",\n                            \"embeddable\": true,\n                            \"monetizable\": false\n                        }\n                    }\n                ]\n            },\n            \"metadata\": {\n                \"result_type\": \"popular\",\n                \"iso_language_code\": \"en\"\n            },\n            \"source\": \"&lt;a href=\\\"https://studio.twitter.com\\\" rel=\\\"nofollow\\\"&gt;Twitter Media Studio&lt;/a&gt;\",\n            \"in_reply_to_status_id\": null,\n            \"in_reply_to_status_id_str\": null,\n            \"in_reply_to_user_id\": null,\n            \"in_reply_to_user_id_str\": null,\n            \"in_reply_to_screen_name\": null,\n            \"user\": {\n                \"id\": 35583547,\n                \"id_str\": \"35583547\",\n                \"name\": \"Kentucky Basketball\",\n                \"screen_name\": \"KentuckyMBB\",\n                \"location\": \"Rupp Arena\",\n                \"description\": \"Official Twitter account for Kentucky Men’s Basketball. #TGT - 𝗧he 𝗚reatest 𝗧radition. Eight-time NCAA champions, winningest program in college basketball.\",\n                \"url\": \"https://t.co/HcLn0lkgYi\",\n                \"entities\": {\n                    \"url\": {\n                        \"urls\": [\n                            {\n                                \"url\": \"https://t.co/HcLn0lkgYi\",\n                                \"expanded_url\": \"http://giphy.com/kentuckymbb\",\n                                \"display_url\": \"giphy.com/kentuckymbb\",\n                                \"indices\": [\n                                    0,\n                                    23\n                                ]\n                            }\n                        ]\n                    },\n                    \"description\": {\n                        \"urls\": []\n                    }\n                },\n                \"protected\": false,\n                \"followers_count\": 791003,\n                \"friends_count\": 653,\n                \"listed_count\": 1217,\n                \"created_at\": \"Sun Apr 26 22:25:01 +0000 2009\",\n                \"favourites_count\": 549,\n                \"utc_offset\": null,\n                \"time_zone\": null,\n                \"geo_enabled\": true,\n                \"verified\": true,\n                \"statuses_count\": 35138,\n                \"lang\": null,\n                \"contributors_enabled\": false,\n                \"is_translator\": false,\n                \"is_translation_enabled\": false,\n                \"profile_background_color\": \"0A11B8\",\n                \"profile_background_image_url\": \"http://abs.twimg.com/images/themes/theme1/bg.png\",\n                \"profile_background_image_url_https\": \"https://abs.twimg.com/images/themes/theme1/bg.png\",\n                \"profile_background_tile\": false,\n                \"profile_image_url\": \"http://pbs.twimg.com/profile_images/1192886378310373378/XGgfxVMk_normal.jpg\",\n                \"profile_image_url_https\": \"https://pbs.twimg.com/profile_images/1192886378310373378/XGgfxVMk_normal.jpg\",\n                \"profile_banner_url\": \"https://pbs.twimg.com/profile_banners/35583547/1502115999\",\n                \"profile_link_color\": \"060404\",\n                \"profile_sidebar_border_color\": \"FFFFFF\",\n                \"profile_sidebar_fill_color\": \"FFFFFF\",\n                \"profile_text_color\": \"060404\",\n                \"profile_use_background_image\": true,\n                \"has_extended_profile\": false,\n                \"default_profile\": false,\n                \"default_profile_image\": false,\n                \"following\": null,\n                \"follow_request_sent\": null,\n                \"notifications\": null,\n                \"translator_type\": \"none\"\n            },\n            \"geo\": null,\n            \"coordinates\": null,\n            \"place\": null,\n            \"contributors\": null,\n            \"is_quote_status\": false,\n            \"retweet_count\": 69,\n            \"favorite_count\": 602,\n            \"favorited\": false,\n            \"retweeted\": false,\n            \"possibly_sensitive\": false,\n            \"lang\": \"en\"\n        },\n        ...\n    ]\n}\n</code></pre><br />\n<br />\n\n<p><em>Sample Tree</em></p>\n<p><img src=\"https://raw.githubusercontent.com/isabelleyzhou/postman_visualizer_templates/master/tree/Twitter.png\" alt=\"alt text\" /></p>\n","urlObject":{"protocol":"https","path":["1.1","search","tweets.json"],"host":["api","twitter","com"],"query":[{"key":"q","value":"@Wendys"},{"key":"result_type","value":"popular"},{"key":"count","value":"50"}],"variable":[]}},"response":[],"_postman_id":"ae6e7a5c-8459-4fd7-8799-804776aa05a3"},{"name":"New York Times: Movie Reviews","event":[{"listen":"test","script":{"id":"02cc2570-1ef7-4710-a7d2-9c36f6c07e2e","exec":["var template = `","<script src=\"https://d3js.org/d3.v5.min.js\"></script>","<style>","body {","    display: flex;","    align-items: center;","    justify-content: center;","    background-color: #F5F5F5;","   ","}","","",".container {","    position: absolute;","    z-index: -999;","    height: 100vh;","    width: 100vw;","}","","</style>","<div id=\"tree\"></div>","<div class=\"container\">","<script>","const treeData = {{{results}}};","var maxChildren = 0;","var treeLevelSpan = {0:1};","","//finds the max number of nodes in a column","function getMaxChildrenSpan(input, level) {","    var childrenLength = 0;","    if (input.hasOwnProperty(\"children\") && input[\"children\"] != null && typeof input[\"children\"] != undefined ) {","        childrenLength =  input.children.length;","    }","    let totalNumChildren = 0;","    if (input.hasOwnProperty(\"children\") && input[\"children\"] != null && typeof input[\"children\"] != undefined) {","        for (let child of input.children) {","            if (child.hasOwnProperty(\"children\") && child[\"children\"] != null && typeof child[\"children\"] != undefined) {","                getMaxChildrenSpan(child, level + 1)","            }","        }","    }","    if (level in treeLevelSpan) {","        treeLevelSpan[level] += childrenLength;","    }","    else {","        treeLevelSpan[level] = childrenLength;","    }","}","getMaxChildrenSpan(treeData, 1);","let arrayOfLevelSpan = Object.values(treeLevelSpan)","let maxSpan = Math.max(...arrayOfLevelSpan);","","","// Set the dimensions and margins of the diagram","var margin = {top: 20, right: 90, bottom: 30, left:90},","    width = 960 - margin.left - margin.right,","    height = 500 + (maxSpan*30) - margin.top - margin.bottom;","","","","// append the svg object to the body of the page","// appends a 'group' element to 'svg'","// moves the 'group' element to the top left margin","var svg = d3.select(\"body\").append(\"svg\")","    .attr(\"width\", width + margin.right + margin.left)","    .attr(\"height\", height + margin.top + margin.bottom)","    .append(\"g\")","        .attr(\"transform\", \"translate(\"","            + margin.left  + \",\" + margin.top + \")\");","","","var i = 0,","    duration = 750,","    root;","","// declares a tree layout and assigns the size","var treemap = d3.tree().size([height, width]);","","// Assigns parent, children, height, depth","root = d3.hierarchy(treeData, function(d) { return d.children; });","root.x0 = height / 2;","root.y0 = 0;","","// Collapse after the second level","// root.children.forEach(collapse);","","update(root);","","// Collapse the node and all it's children","function collapse(d) {","  if(d.children) {","    d._children = d.children","    d._children.forEach(collapse)","    d.children = null","  }","}","","function update(source) {","  // Assigns the x and y position for the nodes","  var treeData = treemap(root);","  ","  //svg height dynamically changed by max number of open nodes in a column","  treeLevelSpan = {};","  getMaxChildrenSpan(root, 1);","  arrayOfLevelSpan = Object.values(treeLevelSpan)","  maxSpan = Math.max(...arrayOfLevelSpan);","  height = 500 + (maxSpan*30) - margin.top - margin.bottom;","  treeData = d3.tree().size([height, width])(root);","","","  // Compute the new tree layout.","  var nodes = treeData.descendants(),","      links = treeData.descendants().slice(1);","","  // Normalize for fixed-depth.","  nodes.forEach(function(d) { d.y = d.depth * width * 0.25 });","","  // ****************** Nodes section ***************************","","  // Update the nodes...","  var node = svg.selectAll('g.node')","      .data(nodes, function(d) {return d.id || (d.id = ++i); });","","  // Enter any new nodes at the parent's previous position.","  var nodeEnter = node.enter().append('g')","      .attr('class', 'node')","      .attr(\"transform\", function(d) {","        return \"translate(\" + source.y0 + \",\" + source.x0 + \")\";","    })","    .on('click', click);","    ","    // Create hover tooltip","    let tooltip = d3.select(\"#tree\").append(\"div\")","        .attr(\"class\", \"tooltip\")","            .style(\"z-index\", 99)","            .style(\"position\", \"absolute\")","            .style(\"font-size\", \"12px\")","            .style(\"width\", \"auto\")","            .style(\"height\", \"auto\")","            .style(\"pointer-events\", \"none\")","            .style(\"background-color\", \"white\")","            .style(\"padding\", \"3px\")","            .style(\"opacity\", 1);","        ","    // tooltip mouseover event handler","    let tipMouseover = function(d) {","        console.log(d);","        tooltip.html(\"Data Type: <br/>\" + d.data.type)","            .style(\"left\", (d3.event.pageX + 40) + \"px\")","            .style(\"top\", (d3.event.pageY - 15) + \"px\")","          .transition()","            .duration(200)      // ms","            .style(\"opacity\", 1)","    };","    // tooltip mouseout event handler","    let tipMouseout = function(d){","        tooltip.transition()","            .duration(300)","            .style(\"opacity\", 0);","    };","    ","  // Add Circle for the nodes","  nodeEnter.append('circle')","      .attr('class', 'node')","      .attr('r', 1e-6)","      .on(\"mouseover\", tipMouseover)","      .on(\"mouseout\", tipMouseout)","      .style(\"fill\", function(d) {","          return d._children ? \"#F4B780\" : \"#fff\";","      })","      ","      .style(\"fill\", \"#F5F5F5\")","      .style(\"stroke\", \"#F09D51\")","      .style(\"stroke-width\", \"2px\");","      ","      ","","  // Add labels for the nodes","  nodeEnter.append('text')","      .attr(\"dy\", \".35em\")","      .attr(\"x\", function(d) {","          return d.children || d._children ? -20 : 20;","      })","      .attr(\"text-anchor\", function(d) {","          return d.children || d._children ? \"end\" : \"start\";","      })","      .text(function(d) { return d.data.name; });","      ","      ","","  // UPDATE","  var nodeUpdate = nodeEnter.merge(node);","","  // Transition to the proper position for the node","  nodeUpdate.transition()","    .duration(duration)","    .attr(\"transform\", function(d) { ","        return \"translate(\" + d.y + \",\" + d.x +\")\";//this","     });","","  // Update the node attributes and style","  nodeUpdate.select('circle.node')","    .attr('r', 10)","    .style(\"fill\", function(d) {","        return d._children ? \"#F4B780\" : \"#F5F5F5\";","    })","    .attr('cursor', 'pointer');","","","  // Remove any exiting nodes","  var nodeExit = node.exit().transition()","      .duration(duration)","      .attr(\"transform\", function(d) {","          return \"translate(\" + source.y + \",\" + source.x + \")\"; ","      })","      .remove();","","  // On exit reduce the node circles size to 0","  nodeExit.select('circle')","    .attr('r', 0);","","  // On exit reduce the opacity of text labels","  nodeExit.select('text')","    .style('fill-opacity', 0);","","  // ****************** links section ***************************","","  // Update the links...","  var link = svg.selectAll('path.link') ","      .data(links, function(d) { return d.id; });","","  // Enter any new links at the parent's previous position.","  var linkEnter = link.enter().insert('path', \"g\")","      .attr(\"class\", \"link\")","      .attr('d', function(d){","        var o = {x: source.x0, y: source.y0}","        return diagonal(o, o)","      })","      .style(\"fill\", \"none\")","      .style(\"stroke\",\"#c5c5c5\")","      .style(\"stroke-width\", \"1px\");","","  // UPDATE","  var linkUpdate = linkEnter.merge(link);","","  // Transition back to the parent element position","  linkUpdate.transition()","      .duration(duration)","      .attr('d', function(d){ return diagonal(d, d.parent) });","","  // Remove any exiting links","  var linkExit = link.exit().transition()","      .duration(duration)","      .attr('d', function(d) {","        var o = {x: source.x, y: source.y}","        return diagonal(o, o)","      })","      .remove();","","  // Store the old positions for transition.","  ","  nodes.forEach(function(d){","    d.x0 = d.x;","    d.y0 = d.y;","  });","\\","  // Creates a curved (diagonal) path from parent to the child nodes","  function diagonal(s, d) {","    path = \"M \" + s.y +\" \" + s.x + \" \" +","           \"C \" + (s.y + d.y)/2 + \" \" + s.x +\", \"","        +  (s.y + d.y)/2 +\" \" + d.x + \" , \"","        +  d.y + \" \" + d.x;","    return path;","  }","","  // Toggle children on click.","  function click(d) {","    if (d.children) {","        d._children = d.children;","        d.children = null;","      } else {","        d.children = d._children;","        d._children = null;","      }","    update(d);","  }"," ","}","","</script>","`;","","/* DATA PARSING */","const response = pm.response.json();","","function parseData(jsonInput) {","    // Function that checks if object is a dictionary","    function isDictionary(obj) {","        if (typeof obj == \"object\" && !Array.isArray(obj) && obj !== null) {","            return true;","        } else {","            return false;","        }","    }","    ","    // Declare and initialize the root node","    const dataTree = {};","    ","    dataTree[\"name\"] = \"response\";","    dataTree[\"children\"] = [];","    dataTree[\"type\"] = typeof(dataTree);","    ","    // Recursively reformats the json file ","    // See documentation for format","    function restructure(input, arr) {","        for (let node in input) {","            const dict = {};","            if (isDictionary(input[node])) {","                dict.name = node;","                dict.type = \"dictionary\"","                dict.children = [];","                restructure(input[node], dict.children);","            } else {","                if (Array.isArray(input[node])) {","                    dict.type = \"array\";              ","                }","                else if (input[node] === null) {","                    dict.type = \"null\";","                }","                else {","                    dict.type = typeof(input[node]);","                }","                dict.name = node;","            }","            arr.push(dict);","        }","    }","    ","    // Calls restructure on the first object in the response","    restructure(jsonInput, dataTree.children);","    ","    return dataTree","    ","}","","/* FEED DATA INTO TEMPLATE */","pm.visualizer.set(template, {","  // Template will receive stringified JSON","  ","  /* here we grab the first object from the reponse dictionary as all","    objects in the dictionary have the same structure */","  results: JSON.stringify(parseData(response.response.docs[0]))","});"],"type":"text/javascript"}}],"id":"d1bd179f-8e27-48aa-9055-a7246ce9ab3b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://api.nytimes.com/svc/search/v2/articlesearch.json?fq=romney&facet_field=day_of_week&facet=true&begin_date=20120101&end_date=20120101&api-key={{NYT_API_KEY_MOVIES}}","description":"<p>Visualizes the structure of the response from the New York Times Movie Reviews API\n<br />\n<br />\n<em>Sample JSON response</em></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>{\n    \"status\": \"OK\",\n    \"copyright\": \"Copyright (c) 2019 The New York Times Company. All Rights Reserved.\",\n    \"response\": {\n        \"docs\": [\n            {\n                \"abstract\": \"With two days before the Iowa caucuses, Newt Gingrich planned to visit three sports bars on New Year’s Day.\",\n                \"web_url\": \"https://thecaucus.blogs.nytimes.com/2012/01/01/on-n-f-l-s-final-sunday-gingrich-makes-his-pitch-at-three-sports-bars/\",\n                \"snippet\": \"With two days before the Iowa caucuses, Newt Gingrich planned to visit three sports bars on New Year’s Day.\",\n                \"lead_paragraph\": \"AMES, Iowa — Where do you find voters on the last Sunday of the regular season of the National Football League?\",\n                \"source\": \"The New York Times\",\n                \"multimedia\": [],\n                \"headline\": {\n                    \"main\": \"On a Big Football Weekend, Gingrich Makes His Plea to N.F.L. Fans\",\n                    \"kicker\": \"The Caucus\",\n                    \"content_kicker\": null,\n                    \"print_headline\": null,\n                    \"name\": null,\n                    \"seo\": null,\n                    \"sub\": null\n                },\n                \"keywords\": [\n                    {\n                        \"name\": \"subject\",\n                        \"value\": \"Bars\",\n                        \"rank\": 1,\n                        \"major\": \"N\"\n                    },\n                    {\n                        \"name\": \"subject\",\n                        \"value\": \"Football\",\n                        \"rank\": 2,\n                        \"major\": \"N\"\n                    },\n                    {\n                        \"name\": \"subject\",\n                        \"value\": \"Presidential Election of 2012\",\n                        \"rank\": 3,\n                        \"major\": \"N\"\n                    },\n                    {\n                        \"name\": \"persons\",\n                        \"value\": \"Gingrich, Newt\",\n                        \"rank\": 4,\n                        \"major\": \"N\"\n                    },\n                    {\n                        \"name\": \"glocations\",\n                        \"value\": \"Iowa\",\n                        \"rank\": 5,\n                        \"major\": \"N\"\n                    }\n                ],\n                \"pub_date\": \"2012-01-01T21:02:05+0000\",\n                \"document_type\": \"article\",\n                \"news_desk\": \"\",\n                \"section_name\": \"U.S.\",\n                \"subsection_name\": \"Politics\",\n                \"byline\": {\n                    \"original\": \"By Trip Gabriel\",\n                    \"person\": [\n                        {\n                            \"firstname\": \"Trip\",\n                            \"middlename\": null,\n                            \"lastname\": \"Gabriel\",\n                            \"qualifier\": null,\n                            \"title\": null,\n                            \"role\": \"reported\",\n                            \"organization\": \"\",\n                            \"rank\": 1\n                        }\n                    ],\n                    \"organization\": null\n                },\n                \"type_of_material\": \"News\",\n                \"_id\": \"nyt://article/c35f8f83-1a05-51aa-a934-af83a91de7bb\",\n                \"word_count\": 528,\n                \"uri\": \"nyt://article/c35f8f83-1a05-51aa-a934-af83a91de7bb\"\n            },\n            \n            . . .\n        ]\n\n    }\n}\n</code></pre><br />\n<br />\n\n<p><em>Sample Tree</em></p>\n<p><img src=\"https://raw.githubusercontent.com/isabelleyzhou/postman_visualizer_templates/master/tree/NYT.png\" alt=\"alt text\" /></p>\n","urlObject":{"protocol":"https","path":["svc","search","v2","articlesearch.json"],"host":["api","nytimes","com"],"query":[{"key":"fq","value":"romney"},{"key":"facet_field","value":"day_of_week"},{"key":"facet","value":"true"},{"key":"begin_date","value":"20120101"},{"key":"end_date","value":"20120101"},{"key":"api-key","value":"{{NYT_API_KEY_MOVIES}}"}],"variable":[]}},"response":[],"_postman_id":"d1bd179f-8e27-48aa-9055-a7246ce9ab3b"}]}