Score:0

intermidiate user, I have to alter a json file to incorporate new values help please?

in flag

This is the code I have to alter, I have copied the file into terminal and now need to put my own ID etc into the code. I used Cat do see this code but not sure how to edit it. Any help appreiated as I am using this for a demonstration of how sleep stats work on facebook.

{
    "fbCookie": {
        "c_user": "",
        "xs": ""
    },
    "pollingInterval": 600,
    "appId": 435522656639081,
    "server": {
        "port": 3000
    }
}
{
    "fbCookie": {
        "c_user": "",
        "xs": ""
    },
    "pollingInterval": 600,
    "appId": 435522656639081,
    "server": {
        "port": 3000
    }
}
Score:0
hr flag

You can use the jq tool for manipulating JSON from the command line, ex.

$ jq --arg u "myuser" '.fbCookie.c_user |= $u' file.json
{
  "fbCookie": {
    "c_user": "myuser",
    "xs": ""
  },
  "pollingInterval": 600,
  "appId": 435522656639081,
  "server": {
    "port": 3000
  }
}
{
  "fbCookie": {
    "c_user": "myuser",
    "xs": ""
  },
  "pollingInterval": 600,
  "appId": 435522656639081,
  "server": {
    "port": 3000
  }
}

or

$ jq --argjson c '{"c_user": "myuser", "xs": "foo bar"}' '.fbCookie |= $c' file.json
{
  "fbCookie": {
    "c_user": "myuser",
    "xs": "foo bar"
  },
  "pollingInterval": 600,
  "appId": 435522656639081,
  "server": {
    "port": 3000
  }
}
{
  "fbCookie": {
    "c_user": "myuser",
    "xs": "foo bar"
  },
  "pollingInterval": 600,
  "appId": 435522656639081,
  "server": {
    "port": 3000
  }
}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.